CBFalconer said:
If you want the ease of supplying function parameters of gets, I
recommend ggets. ggets is written in standard C, thus is totally
portable, and all you supply it is the address of a char* pointer.
The penalty is that you have to dispose of that pointers data space
after the call (unless you want to preserve that line for longer)
by using free. It is accompanied by fggets, which is identical but
allows you to specify the input file. See:
I've never in my programming life seen someone talk up such a
trifle. Reusable snippets are one thing, but talking up a tiny
I/O + realloc() wrapper as if it's a finished product in itself
and the first of its kind is an entirely different thing. Next
Chucky will be shipping off his ggets() as a .deb package.
[SCENE: SOPHOMORE COMPUTER SCIENCE CLASS]
PROFESSOR: Last week's homework was writing a line-reading
function. I've had a chance to look over the submissions,
and they're all pretty good. This week your project
will be writing a base64 decoder, after we've looked
at -- oh, just a moment, we have a special guest with
us today...
CHUCK FALCONER: Hello, I'm Chuck Falconer. Thank you.
Thank you, people. Thank you. OK, people, thank
you. If I may... IF I MAY... yes, thank you. OK,
yes. Please, thank you. Thank you very much. I'm
honored. Thank you. Can I have some silence please?
I appreciate... yes. Thank you. You're all kind.
PROFESSOR: Sir, if I may say so, the class has been silent
since you walked in the room.
Yours,
Han from China