Skip to content

Instantly share code, notes, and snippets.

@pmn
Created October 3, 2012 17:50
Show Gist options
  • Save pmn/3828571 to your computer and use it in GitHub Desktop.
Save pmn/3828571 to your computer and use it in GitHub Desktop.
Second Scanf getting skipped?
func getConnectionInfo() string {
// Prompt the user for connection string info
var servername, username, password string
fmt.Print("Enter Server Name:")
fmt.Scanf("%s", &servername)
fmt.Print("Enter User Name:")
fmt.Scanf("%s", &username)
fmt.Print("Enter Password:")
fmt.Scanf("%s", &password)
connstr := "Server=" + servername + ";user id=" + username + ";password=" + password
return connstr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment