String reading in c
I have little doubt about string reading in C.
string reading functions like gets, scanf, read, fscanf , fgets...
which C function can do a secure or safe string reading from any file?
Or
Which C开发者_StackOverflow社区 function can be reliable to read a string in a file ?
An input function will be secure/safe(not allow buffer overflow) if it takes the length of the buffer as an arguments so that the function does not read more char than the buffer can hold.
Of the function you've listed fgets() and read() take the buffer length as argument and can be considered safe.
Seems like you are simply asking how to read in a file. Google was helpful for me:
http://www.cprogramming.com/tutorial/cfileio.html
http://msdn.microsoft.com/en-us/library/aa365467%28VS.85%29.aspx
Read around or expand your question so we can answer you better.
精彩评论