Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!tank!uxc!uxc.cso.uiuc.edu!m.cs.uiuc.edu!kenny From: kenny@m.cs.uiuc.edu Newsgroups: comp.lang.c Subject: Re: gets(3) nonsense Message-ID: <4700029@m.cs.uiuc.edu> Date: 17 Nov 88 06:28:00 GMT References: <434@auspex.UUCP> Lines: 16 Nf-ID: #R:auspex.UUCP:434:m.cs.uiuc.edu:4700029:000:731 Nf-From: m.cs.uiuc.edu!kenny Nov 17 00:28:00 1988 /* Written 11:16 am Nov 15, 1988 by rkl1@hound.UUCP in m.cs.uiuc.edu:comp.lang.c */ Well, I suppose that if gets () is capable of overflowing the buffer, the way to go would be to read the input one character at a time and check for buffer overflow oneself. It would be trivial to write a function to do this, and you only have to do it once and use it from then on instead of gets () /* End of text from m.cs.uiuc.edu:comp.lang.c */ How convenient that the deigners of the stardard C library have done this for us already. It's called fgets(). Please, can we go to another topic? I've got one: do fseek(), fread (), and fwrite() allow a forward read after a write? Does it matter whether it's a text or binary file? A-T