tags:

views:

66

answers:

3

Hi , this maybe a noobish question so sorry, is it possible to run c programmes from cmd?

I am in the process of creating a programme that takes 3 command line arguments, a string seperator and 2 file names and i have conditions such as if more or less command line items are passed then print an error etc

i cannot test this from dev-c++ as i dont no how and would find it easier to use cmd i guess

thanks for the help

+6  A: 

Yes, you can do that:

c:\> cd c:\directory\where\the\program\is
c:\directory\where\the\program\is> program arg1 arg2 arg3 separator file1 file1
Carl Norum
A: 

Use the dev-c++ debugger (you activate it by pressing F9). And yes, you can run C programmes from cmd. The call would be:

C:\MyProgram.exe param1 param2 param3
brozo
the issue is that it just dissapears so quickly :D
haz
+2  A: 

Also Somewhere in dev-c++ there will be an entry for 'command arguments' or 'string to execute' to allow you to specify them - sorry don't know dev-c++ specifically.

Martin Beckett
yes but it has only one space for parameter, and even then the pop up cmd window just flashes and dissapears in an instant :D
haz
Hi sam - I might know what's giving you grief here. Try going to the Start menu -> Run, and type "cmd.exe". This should bring up a command window. Now try following the directions from Carl Norum in his answer. This will prevent the program from just disappearing right away. Good luck!
Mike