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
Get step-by-step solutions from verified subject matter experts
