0

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.

6
  • 1
    This is not really a programming question and you've already been given two examples of how to do this in response to your previous question: Passing a URL to a specific piece of example code which extracts samples from a WAV file. Commented Feb 9, 2011 at 15:57
  • @ Paul R. I just thought it would be better to specify this detail in a new question, especially since the last one was more about that specific piece of code. No one searching for the above answer would have found it in the previous thread. Likewise, I could have been possibly a bit more patient in getting my response from the original query. My apologies. What is the protocol for a proper reaction to a negative voting? In other words, what should I now do about this blemish on my reputation? :) Commented Feb 9, 2011 at 16:04
  • 1
    @Eric: (a) it's not a programming question (belongs on superuser.com) and (b) you already had all the information you needed from the previous question (see comments below the answers you were given). Commented Feb 9, 2011 at 16:05
  • @Eric: you have now accepted an answer which isn't even correct (not really the answerer's fault - the question is unclear) - you should probably fix this otherwise someone else reading this question will be misled. Commented Feb 9, 2011 at 16:23
  • @Paul. Sorry about all the confusion. And thanks for putting in all the effort :) Commented Feb 9, 2011 at 16:35

4 Answers 4

1

Open Terminal and do the following:

$ cd /Users/tomcruise/Desktop
$ ./executable < music.wav
Sign up to request clarification or add additional context in comments.

2 Comments

Correct me if I'm wrong, but shouldn't it be ./executable. I think you missed out on the ./
Thanks, yes, it depends on your PATH, that would be better in the general case - I've updated the answer now.
1

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.

1 Comment

His executable takes input from stdin
0

If your executable is taking from command line arguments, it would be:

/Users/tomcruise/Desktop/executable /Users/tomcruise/Desktop/music.wav

If it is taking from stdin, it would be:

/Users/tomcruise/Desktop/executable < /Users/tomcruise/Desktop/music.wav

Comments

0

You write the argument just after the filename:

cd /Users/tomcruise/Desktop
./executable music.wav

1 Comment

His executable takes input from stdin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.