Skip to content

Instantly share code, notes, and snippets.

@alekseytimoshchenko
Created December 21, 2019 18:15
Show Gist options
  • Save alekseytimoshchenko/f34793fae7f4ad4311234caed355334e to your computer and use it in GitHub Desktop.
Save alekseytimoshchenko/f34793fae7f4ad4311234caed355334e to your computer and use it in GitHub Desktop.
fp = fopen("/tmp/test.txt", "r");
if (fp == NULL)
{
printf("\nERROR : file open failed\n");
return 0;
}
while (fgets(buffer, MAX_NAME_LENGTH, (FILE *)fp))
{
printf("%s\n", buffer);
}
fclose(fp);
if (line)
free(line);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment