RE: [Dev-C++] Again with: gets,fgets,getline
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ya...> - 2001-04-19 10:34:24
|
There is no getline() in the C standard library. There are gets() and fgets() to read lines. 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:13 AM > To: dev...@li... > Subject: [Dev-C++] Again with: gets,fgets,getline > > > <I have experienced problems with the function "gets". > <It seems that in my program is using memory addresses that shouldn't u= se > 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? > > Here I have an example: > > /*------------------------------------------------------*/ > > #include <stdio.h> > > > int main() > { > char pep[255],pitu[255],nitu[255],*pt,*ptg; > int i; > FILE *fp; > > printf("Write something\n"); > gets(pep); > printf("Write something more\n"); > fgets(pitu,255,fp); > printf("Write something more again\n"); > pt =3D (char)malloc(256*sizeof(char)); > getline(pt,255,fp); > > system("PAUSE"); > return 0; > } > > /*------------------------------------------------------*/ > > > > _______________________________________________________________ > 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 > |