Question: #include #define MAX_LEN 1000 int main() { char str[MAX_LEN]; FILE* pFile; pFile = fopen(test.txt, r); if (pFile == NULL) { printf (Error opening file );

#include

#define MAX_LEN 1000

int main()

{

char str[MAX_LEN];

FILE* pFile;

pFile = fopen("test.txt", "r");

if (pFile == NULL)

{

printf ("Error opening file ");

return 1;

}

while ( fgets (str, MAX_LEN, pFile ) != NULL )

{

printf ("%s", str);

}

return 0;

}

#include #define MAX_LEN 1000 int main() { char str[MAX_LEN]; FILE* pFile; pFile

Exercise Modify read file. C (posted on Canvas Week 11 Example Programs) so that the file name is obtained from the command line

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!