System("commands")

This is a discussion on System("commands") within the C Programming forums, part of the General Programming Boards category; just wondering if the system(argument) function is compiler specific. I am using Dev c++ 4.0 and i have used it ...

  1. #1
    Registered User caroundw5h's Avatar
    Join Date
    Oct 2003
    Posts
    751

    System("commands")

    just wondering if the system(argument) function is compiler specific.

    I am using Dev c++ 4.0 and i have used it in the following way

    system("pause")
    and
    system("cls")


    I cannot find them in two C reference libraries i have so i was just wondering.

    Also what are the optional arguements or more acurately - parameters.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,306
    I think it is platform specific, since you're running system commands, and such commands differ from system to system.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    The system function itself is completely portable in standard C. However, the string you pass it is not even close to portable. A good example is system ( "cls" ). This works fine on DOS and Windows systems, but fails on Linux and Unix systems. On those machines, you would need system ( "clear" ).
    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    http://www.freebsd.org/cgi/man.cgi?q...ts&format=html

    Specifically:

    STANDARDS
    The system() function conforms to ISO/IEC 9899:1990 (``ISO C89'') and is
    expected to be IEEE Std 1003.2 (``POSIX.2'') compatible.


    ISO C89 being the current most implemented verion of 'C'. As in, any conforming compiler has this function.

  5. #5
    Registered User
    Join Date
    Nov 2003
    Posts
    9
    hi,

    yes it is platform dependent. In DOS you can pass arguments like "cls" , "pause" , "dir..." , etc. If you are using UNIX environment then these commennds can be used - "clear", "more" , "ls ..." , etc.

    bye
    Praveen

  6. #6
    Registered User caroundw5h's Avatar
    Join Date
    Oct 2003
    Posts
    751
    Originally posted by praveen_23
    hi,

    yes it is platform dependent. In DOS you can pass arguments like "cls" , "pause" , "dir..." , etc. If you are using UNIX environment then these commennds can be used - "clear", "more" , "ls ..." , etc.

    bye
    Praveen

    Thanks for your answers guys. Where can i find the optional parameters to be given to the system function. Or what are they?

  7. #7
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Where can i find the optional parameters to be given to the system function.
    Your system's help files give available commands. For DOS and Windows, type help at the command prompt and you will get a nice little list.
    My best code is written with the delete key.

  8. #8
    Registered User
    Join Date
    Nov 2001
    Posts
    202
    for linux hit tab twice and read VERY VERY fast. :-)
    "Christ died for our sins. Dare we make his martyrdom meaningless by not committing them?"

  9. #9
    Registered User
    Join Date
    Nov 2003
    Posts
    9
    if ur using Dev C++ then u have to pass the "clear" instead of "cls" and for "pause" i don't know the related unix argument bcoz Dev C++ is designed similar to GNU C Compiler(GCC).

    ok....look into the command list of unix and dos which perform the similar task..

    bye
    Praveen

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,854
    Quit bumping threads Praveen
    This one was over 3 months old
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  11. #11
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    can some mod lock this thread???

Popular pages Recent additions subscribe to a feed

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