c - Read an integer from a .txt file opened from command line -


I need to read an integer from a .txt file open from the command line, such as:

  myprogram & lt; Input.txt  

I can not use scanf because it does not read anything, nor FSACN because I'm not opening the file in this program. Works for string lines in the file, but there is no such thing as "getint" to read the integer line.

This is what looks like my file:

  5 // The number of the following words word 1 word 2 word 3 word 4 word 5  
< / Div>

& lt; Redirect means that the content of input.txt will be redirected to your program's standard input. This means that you should be able to use the scanf () to read the file content (or any other function that is read from standard input).


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -