PDA

View Full Version : Is there a way to insert command line params into a compiler?



indigo0086
08-23-2006, 06:14 PM
I totally stink when it comes to using the cmd command line and wanted to know if there was an easier way, perhaps a way in the compiler (currently using Code::Blocks) to do so? I am trying to pass arguments to main and wanted to know if there is a way.

SlyMaelstrom
08-23-2006, 06:37 PM
Write your program, then write another program that calls it with a system() or CreateProcess() call. :)

Mario F.
08-23-2006, 07:37 PM
Probably the best option right now is to create a batch file... if you are not planning changing the arguments all the time.

Code::Blocks does have a somewhat tricky option. You can use the post build commands under the compiler settings. However it runs inside C::B build log pane, which basically renders your program useless if it expects user input.

Use a batch file

joeprogrammer
08-23-2006, 08:28 PM
What's so hard about the command line?
Happy birthday, Mario! ;)

SlyMaelstrom
08-23-2006, 08:41 PM
What's so hard about the command line?
Happy birthday, Mario! ;)Nothing that isn't even more difficult with a BATCH file...
...or a second C program for that matter. :/

Happy *burp*day, Mario.

Dave_Sinkula
08-23-2006, 08:53 PM
I totally stink when it comes to using the cmd command line and wanted to know if there was an easier way, perhaps a way in the compiler (currently using Code::Blocks) to do so? I am trying to pass arguments to main and wanted to know if there is a way.Happy Birthday Mario!

indigo0086
08-24-2006, 05:27 AM
Thanks a lot Dave. I kept trying to insert them in the build options.


What's so hard about the command line?
Happy birthday, Mario! ;)

I don't know, I guess it's just me. Every time I try to navigate to my folder it ends up either not taking in basic commands because I missed some syntax or I just give up because it's too tedious. I couldn't imagine having to run my compiler over and over by Command line.

Mario F.
08-24-2006, 05:42 AM
Wow. I can't understand how I missed that option.

As for the command line, I guess you could do the same as I do. I just keep the console window opened all the time. I don't use cmd though. I use Take Command which does offer a lot in terms of toning down key pressing. I can't relate to your difficulty though. I use gdb on the command line all the time :)

thanks everyone!

VirtualAce
08-24-2006, 05:46 AM
Nearly every IDE worth the trouble of using it provides a way, if not several ways, to add command line arguments.

Heck as of about QuickBasic 4, it supported this feature. Turbo C++ 1.01 from way back when dino's walked the earth also supported command line arguments.

indigo0086
08-24-2006, 05:53 AM
Wow. I can't understand how I missed that option.

As for the command line, I guess you could do the same as I do. I just keep the console window opened all the time. I don't use cmd though. I use Take Command which does offer a lot in terms of toning down key pressing. I can't relate to your difficulty though. I use gdb on the command line all the time :)

thanks everyone!

I'll look into it, (though it's far from free) though are there many things I can do with Command line that can't be done on a compiler (give I know what I'm doing). I'm just still in the mindset that that is the "old way", but I guess it works, just too much directory mining to get to what I want.