Xcode (c++) into terminal

Sorry, this is a repost, but I just can't seem to figure this out.

I'm currently running a program through the terminal, and making commands to this program through the terminal
(e.g. alias program="source /filepath")
This program (CIAO) requires a lot of manual input that varies by a small amount each line. I figured I could write up a C++ program that would put in these lines of code for me, each line changing by a set increment. I've tried looking into piping but I don't fully understand how it works (I'm new to C++), and I've seen things like popen and NSTask but I'm not sure what would work or what I could use that would be easiest. I thought maybe just doing a simple system() line would make it go through the shell and work but that was to no success. Here's the line (the cout) I want to go through the terminal 300+ times:
int p=0;
	do {
		cout<<"dmmakereg region=\"BOX("<< s - x <<","<< t - y <<","<< l <<","<< w <<","<< r <<")\" outfile=region.reg\n";
		Sleep(750);
		x = x + 0.93;
		y = y + .368;
		p++;
	} while (p<300);


Last time I posted someone suggested I try something like:

$ ./program.bin | CIAO #send the output of the program as input to CIAO
$ CIAO < input #use a text file that holds the input


But it didn't quite work, and I can't look up what these operators and symbols do because apparently google straight up ignores characters like $ and |. If anyone could point me in the right direction I would be greatly appreciated!
It's a straight repost of your last thread. Anyway, I'll make the same suggestion.

Just script this. It will be easier and more suited to the task. There is a scripting language out there called Expect that was made seemingly for this task. And it's pretty easy to pick up.

I believe in picking in the right tool for a job, hence why I suggest Expect.
Thank you very much! I'll look into right away. Sorry that your suggestion last time got lost on me...
It's alright. Scripting languages are inherently easier to learn. I actually picked up Expect one day at work to help automate some switch configurations.
stream redirection and pipes.
$ is the prompt.

¿Could you describe the issue?
yeah, I can't look at the code right now but if I remember correctly it had a problem with the include directory, and I couldn't figure out what was needed to get it to work.
Topic archived. No new replies allowed.