This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

scanf, linux and solaris


Hi, I've been trying to scan in a string using scanf. The following code works fine on Solaris but breaks on Linux(tested on two different boxes) with a seg fault. Currently it breaks when the username is longer than 10 chars, on a previous attempt before rebooting it would break when the username was longer than 6 chars. 
Any help would be appreciated.

#include <stdio.h>

main(){
char* username;
printf("Username:");
scanf("%s", &username);
}



Get 250 color business cards for FREE!
http://businesscards.lycos.com/vp/fastpath/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]