Question: Using C++ Write the unix cat program. For each filename on the command line, open that file, read its contents, and write it to stdout.
Using C++
Write the unix cat program.
For each filename on the command line, open that file, read its contents, and write it to stdout.
Hint:
int main(int argc, char **argv)
{
for (int i=1; i { FILE *f = fopen(argv[i], r); /* TODO: more stuff. Maybe use fread() or fgets() Ex. char buf[1024]; int r=fread(buf,1,sizeof(buf),f); */ fclose(f); } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
