Is there a way to insert command line params into a compiler?

This is a discussion on Is there a way to insert command line params into a compiler? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I totally stink when it comes to using the cmd command line and wanted to know if there was an ...

  1. #1
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901

    Is there a way to insert command line params into a compiler?

    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.

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,074
    Write your program, then write another program that calls it with a system() or CreateProcess() call.
    Sent from my iPad®

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510
    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
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #4
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498
    What's so hard about the command line?
    Happy birthday, Mario!

  5. #5
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,074
    Quote Originally Posted by joeprogrammer
    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.
    Sent from my iPad®

  6. #6
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Quote Originally Posted by indigo0086
    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!
    Attached Images Attached Images  
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  7. #7
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Thanks a lot Dave. I kept trying to insert them in the build options.

    Quote Originally Posted by joeprogrammer
    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.

  8. #8
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510
    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!
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #9
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    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.

  10. #10
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Quote Originally Posted by Mario F.
    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.
    Last edited by indigo0086; 08-24-2006 at 05:55 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to insert data to the top of exist text file?
    By ooosawaddee3 in forum C++ Programming
    Replies: 4
    Last Post: 08-16-2005, 08:08 AM
  2. OpenScript2.0 Compiler
    By jverkoey in forum C++ Programming
    Replies: 3
    Last Post: 10-30-2003, 12:52 PM
  3. Compiler Design... Anyone That Can Help!
    By ComputerNerd888 in forum C++ Programming
    Replies: 3
    Last Post: 09-27-2003, 09:48 AM
  4. Comile problem using latest Dev C++ Compiler
    By shiny_dico_ball in forum C++ Programming
    Replies: 6
    Last Post: 06-06-2003, 05:32 PM
  5. Replies: 1
    Last Post: 09-17-2001, 05:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21