Hello everyone,
I need to know how to code a program so that it will accept redirection. This program is supposed to accept a list of numbers and store them in variables for later use in the program. When putting numbers in on the command line as arguments, it works fine... but as soon as I type this on the command line -
myprog.exe < data.txt
- I get a stack dump. data.txt contains numbers separated by spaces and line feeds, and myprog.exe is the compiled prog. I use argc and argv[], and I run into stack dumps with the redirection.
I need to make my program understand how to accept input from redirection. And the catch here is - *without* using file functions, using only redirection.
Maybe if someone has a simple and short sample code laying around similar to this, could you post it?
Any comments, ideas, or anything else are welcome.
Thanks,
Cake. [sig][/sig]
I need to know how to code a program so that it will accept redirection. This program is supposed to accept a list of numbers and store them in variables for later use in the program. When putting numbers in on the command line as arguments, it works fine... but as soon as I type this on the command line -
myprog.exe < data.txt
- I get a stack dump. data.txt contains numbers separated by spaces and line feeds, and myprog.exe is the compiled prog. I use argc and argv[], and I run into stack dumps with the redirection.
I need to make my program understand how to accept input from redirection. And the catch here is - *without* using file functions, using only redirection.
Maybe if someone has a simple and short sample code laying around similar to this, could you post it?
Any comments, ideas, or anything else are welcome.
Thanks,
Cake. [sig][/sig]