Commands from eclipse(c++) into terminal

I'm lost, if something I say makes no sense please tell me and I can try to elaborate more...

Anyways, I'm having to run a program through the terminal on my mac, and it requires a large amount of repetitive manual input, which I thought could perhaps be streamlined through a program in C++ or the like. I'm running a Mac OS X snow leopard and I'm using eclipse to make my program...

I already coded out the easy part of what it needs to manually enter, the hard part is having this code be put into the terminal. Is there anyway I can even do this? I haven't had that much experience with coding. Any guidance on what kind of script I should look into, or any help at all would be greatly appreciated!

EDIT: messed up a couple of words o.o
Last edited on
Might as well just write up a script for this. Or whatever the equivalent of a batch file is on Mac.
Yes, script is 1 way. Also you can use parameter lists as 1 way with scripts:

./a.out input1 input2 input3....

And in your program:

int main(int argc, char ** argv)
// some code...
for (int i=1; i<argc; i++) {
// code to handle arguments. For example:

//rest of code 

sorry for no tabs (ipad)
Last edited on
Thanks for the reply yall. I'm not sure I entirely understand which part of that would make it go into the terminal but i'll keep looking, studying and seeing what I can do. I need this program to create a bunch of lines in a specific terminal window, that has the application set up. Maybe this will help clarify what it is I'm trying to do, my current program looks like this:
#include "stdafx.h"
#include <iostream>
#include <Windows.h>

using namespace std;
int main()
        float x;
	float y;
	float s;
	float t;
	float l;
	float w;
	float r;
	cout<<"X coordinate: ";
	cin>> s;
	cout<<"Y coordinate: ";
	cin>> t;
	cout<<"Length: ";
	cin>> l;
	cout<<"Width: ";
	cin>> w;
	cout<<"Rotation: ";
	cin>> r;
	x = 0;
	y = 0;

	int p=0;
	do {
		cout<<"dmmakereg region=\"BOX("<< s - x <<","<< t - y <<","<< l <<","<< w <<","<< r <<")\" outfile=region.reg\n";
		x = x + 0.93;
		y = y + .368;
	} while (p<300);

I made this on my windows, but I think I could copy it over pretty easy to eclipse. The line I need in my terminal is the cout with "dmmakereg"... and I need that 300 times over, so yeah heh...
Last edited on
Topic archived. No new replies allowed.