I have an executable that I need to take input from a .wav file on my desktop. The executable expects input on stdin.
Let us use the example:
/Users/tomcruise/Desktop/executable
/Users/tomcruise/Desktop/music.wav
I am using Mac OS X.
I have an executable that I need to take input from a .wav file on my desktop. The executable expects input on stdin.
Let us use the example:
/Users/tomcruise/Desktop/executable
/Users/tomcruise/Desktop/music.wav
I am using Mac OS X.
Open Terminal and do the following:
$ cd /Users/tomcruise/Desktop
$ ./executable < music.wav
PATH, that would be better in the general case - I've updated the answer now.What exactly is your question? stdin is not the same as command line arguments. The latter is a file descriptor that is available to the program on startup. The latter are a bunch of strings available as strings. Running
/Users/tomcruise/Desktop/executable /Users/tomcruise/Desktop/music.wav
will "give" the music.wav filename to your executable which you can process.
You write the argument just after the filename:
cd /Users/tomcruise/Desktop
./executable music.wav