From what I see, the library is not used in this CS50 sample code and yet, it's included:
#include <stdio.h>
//#include <unistd.h>
int main(int argc, char* argv[])
{
if (argc != 2)
{
printf("Usage: %s [name of document]\n", argv[0]);
return 1;
}
FILE* fp = fopen(argv[1], "r");
if (fp == NULL)
{
printf("Could not open %s\n", argv[1]);
return 1;
}
char output[256];
for (int i = 1; fgets(output, 256, fp) != NULL; i++)
printf("Line %02d: %s", i, output);
fclose(fp);
return 0;
}
I commented out the include line for unistd and the program runs fine. I couldn't find a man page for it, but I did find this.
I looked through the functions, and could not find one that is being used. I'm sure there's a reason it is included. What is that reason?
Thanks for any help.