On Wednesday 05 October 2005 12:27, jalkadir wrote: > I am trying to get character string from the user, to do that I use > getline(char_type*, streamsize), but I get a segmentation fault??!! > > Can anyone give me a hand, what am I doing wrong? > > --snip > char* cstr; > > std::cout << "House/Appartment # "; > std::cin.getline(cstr, CHAR_MAX); //<<==seg fault
Your pointer is not pointing to memory. I would do it like this: char cstr[CHAR_MAX]; std::cin.getline(cstr, CHAR_MAX); -David -- # Department of Applied Physics and Applied Mathematics # Columbia University _______________________________________________ Help-gplusplus mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gplusplus
