uname: Use fgets()
This commit is contained in:
parent
a1a1157151
commit
26324259f2
@ -9,16 +9,8 @@ int main()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[4096];
|
char buf[32];
|
||||||
size_t nread = fread(buf, sizeof(buf) - 1, 1, fp);
|
fgets(buf, sizeof(buf), fp);
|
||||||
|
|
||||||
if (ferror(fp))
|
|
||||||
{
|
|
||||||
perror("fread");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf[nread] = 0; // null terminate it :)
|
|
||||||
|
|
||||||
printf("%s\n", buf);
|
printf("%s\n", buf);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user