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?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top