|
From: Ioannis V. <no...@ya...> - 2001-04-19 13:37:21
|
gets() must be provided with a pointer to allocated space either a static array or a dynamic allocated "array" on the free store (malloced, e.t.c.). If the characters read by gets() are more than the space allocated you ge= t into problems. If you want to guarantee that the length of the string is = not more than the allocated space use fgets(). Ioannis * Ioannis Vranos * Programming pages: http://members.nbci.com/noicys * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...]On Behalf Of > Albert Vilella Bertran > Sent: Thursday, April 19, 2001 11:10 AM > To: dev...@li... > Subject: [Dev-C++] gets,fgets,getline > > > I have experienced problems with the function "gets". > It seems that in my program is using memory addresses that shouldn't us= e > because it writes on some of my dynamic memory space. > > I have read the "The GNU C Library" and while trying to use > "getline" instead > of "gets", it seems that getline is not in "stdio.h". In fact, > searching for it > in "stdio.h" like >Ctrl+F-> "getline", it doesn't found it. > > I dunno what's happening. > > Does anybody know anything I can try? > > > _______________________________________________________________ > Do You Yahoo!? > Env=EDa mensajes instant=E1neos y recibe alertas de correo con > Yahoo! Messenger - http://messenger.yahoo.es > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |