Hi everyone,

I was wondering if there's a way to write a command to the terminal from a c++ program. I'd like to be able to have some kind of loop with a Makefile, so the last command on a makefile runs the makefile again. Otherwise, is there a way to do it in C, Perl, or any other language (although I'd prefer C or Perl because I'm familiar with them). Or, is there a way to make a makefile loop?

Thanks for any answers!

I'm not sure I understand what you want to accomplish exactly, but consider first using a shell file (.sh in Unix/Linux or .bat in win console). I'm not sure how you should write it because I don't understand the goal, but I'm pretty sure that will be enough. If you want to write a command from a program, call "system(command_string);" that's all (at least for Linux/Unix).

Thanks. I don't exactly know what you're talking about, but thanks for the info. I'm using libcurl. I don't want to use C, so instead, I'm going to use a makefile to do this (don't know what to put after CODE - this is a makefile):

curl "http://www.google.com/" input_data > a.txt 2>&1

Oh, and I use Linux (Ubuntu), too. I'll go check out the Shell stuff.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.