New to files in C, trying to read a file via fread
Here's the content of the file:
line1 how
Code used:
char c[6];
fread(c,1,5,f1)
When outputting var 'c', the contents appear with a random character at the end (eg: line1*)
Does fread not terminate the string or am I missing something?
fread
only reads bytes into buffers. it knows nothing of what you call a string. – Negron