Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Extreme343GS

macrumors newbie
Original poster
Jan 26, 2010
10
0
We usually do this for windows:

java test < in.txt > out.txt
or
test.exe < in.txt > out.txt

to direct i/o stream i/p and o/p to the in.txt and out.txt respectively.

How do i do it in osx?
 
not helping.

i would. but it ain't working.

Code:
-bash: in.rtf: No such file or directory

but "in.rtf" is in the working directory.
 
What is the whole command you are using?


To make the contents of a file serve as the input to a command, use "<":

$ wc < RightNow.txt
2 12 58

As is so often the case in shell programming, there is at least one other way to produce the above result:

$ cat RightNow.txt | wc
2 12 58
 
This is what i write:

Code:
Program\ Files/Scripter/test <in.rtf> out.rtf

in terminal. What i expect to happen is that the "cin>>" or any other I/P stream command takes the I/P from the in.rtf. Works as a good test case model for I/P values.

Btw i just the problem. you need to change the working directly with "cd".
Thanks anyways.
 
On Unix environments current directory is not in the search path, so if your files in.rtf and out.rtf are in the current directory proper way to address them is:
./in.rtf and ./out.rtf.

Your command should look like java < ./in.rtf > ./out.rtf
 
On Unix environments current directory is not in the search path, so if your files in.rtf and out.rtf are in the current directory proper way to address them is:
./in.rtf and ./out.rtf.

Your command should look like java < ./in.rtf > ./out.rtf

Files used as command arguments or redirections don't have to be in the search path.

There is no functional difference between "./in.rtf" and "in.rtf" when used as stream redirections. There would be a difference if they were used as a command, but they're not being used that way, so it's irrelevant.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.