Question: How do I print a file name? I have the filename coming from the ls | ./sourcefile. Here is the code I have so far.

How do I print a file name? I have the filename coming from the ls | ./sourcefile. Here is the code I have so far.

#include

#define OFFSET 16

int main (int argc, char const *argv[])

{

char buff[OFFSET] = "";

int read, address = 0, i;

FILE *fp = argc > 1 ?

fopen (argv[1], "r"): stdin;

if (!fp) {

//print file name

return 0;

}

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!