0

I need to input a file in a c program for Linux

a.out < inputfile

The problem is that i don't know how to receive a file

it can't be like:

FILE *fp;
char filename[100];
fopen = (fp,"r");
...

I need as input the file, no the name.

Is there anyway to do this?

exsnake
  • 1,767
  • 2
  • 23
  • 44

1 Answers1

1

Use stdin as your file pointer. It's already declared and open You don't need an fopen

nicomp
  • 4,344
  • 4
  • 27
  • 60