> I have experienced problems with the function "gets".
> It seems that in my program is using memory addresses that shouldn't use
> because it writes on some of my dynamic memory space.
gets doesn't test the size of the input buffer. The buffer must be long
enough to hold all input characters.
> 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.
According to the standard getline is in <string>. However, this is a C++
only function that reads the string class object from objective streams.
I don't know if there is any getline for char * in the GNU C library -
if so, it might be anywhere.
--
============================================================
Ing. Boleslav Vrany
Stanice techniku DDM hl. m. Prahy
Pod Juliskou 2a
Praha 6 - Dejvice
16000
Czech Republic
tel. (420 2) 243 10 240
|