Question

I am using a C program which takes file contents as input. I am using input redirection at the command line to read the file. Can I use getchar() to obtain the content of the file? Or should I be reading it into a certain array and then access it?

Was it helpful?

Solution

Yes sure you can use any method to read input from file while running program through command. You do not need to format it at all. the data in file should appear as if typed on command line while providing inputs. May be this helps. Please provide more insight if this does not help.Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top