return value by system (schell) command in C .
  • Caterpillar
    Caterpillar
    Posts: 23 from 2018/4/20
    I can,t find how I do . in C programming

    Example .

    char time
    time = system (date , 0);

    *I will take the date like I type in shell "date" = Dinsdag 26-jun-2018 11.23.56

    also command diskfree

    Example .

    int free
    free = system (diskfree work: nopostfix , 0);

    * Can somebody give a easy example to do that .
  • »26.06.18 - 13:48
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    BSzili
    Posts: 559 from 2012/6/8
    From: Hungary
    What you are looking for is not the return value, but the output of the command. The easiest way is to redirect it into a file in T: and read it for your program.
    This is just like television, only you can see much further.
  • »26.06.18 - 14:24
    Profile Visit Website
  • Caterpillar
    Caterpillar
    Posts: 23 from 2018/4/20
    Quote:

    BSzili wrote:
    What you are looking for is not the return value, but the output of the command. The easiest way is to redirect it into a file in T: and read it for your program.


    Correct I will use the output of cli command .
    I can read a file , no problem , if i can put the output in a file , then i must have the output ?
  • »26.06.18 - 15:37
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    Tcheko
    Posts: 538 from 2003/2/25
    From: France
    Quote:

    Olystany wrote:
    Quote:

    BSzili wrote:
    What you are looking for is not the return value, but the output of the command. The easiest way is to redirect it into a file in T: and read it for your program.


    Correct I will use the output of cli command .
    I can read a file , no problem , if i can put the output in a file , then i must have the output ?




    You should consider reading the SDK documentation. Also, there is a still valid book about all those AmigaDOS things: The Amiga Guru Book from Ralph Babel which worth to be owned just for the chapter starting quotes.
    Quelque soit le chemin que tu prendras dans la vie, sache que tu auras des ampoules aux pieds.
    -------
    I need to practice my Kung Fu.
  • »27.06.18 - 06:21
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    polluks
    Posts: 813 from 2007/10/23
    From: Gelsenkirchen,...
    Quote:

    Olystany schrieb:
    Quote:

    BSzili wrote:
    What you are looking for is not the return value, but the output of the command. The easiest way is to redirect it into a file in T: and read it for your program.


    Correct I will use the output of cli command .
    I can read a file , no problem , if i can put the output in a file , then i must have the output ?



    By the way it's not a good style to depend on external commands for simple tasks if you also have a dedicated API.
    An ARexx script should of course use diskfree.
    Pegasos II G4: MorphOS 3.9, Zalman M220W · iMac G5 12,1 17", MorphOS 3.18
    Power Mac G3: OSX 10.3 · PowerBook 5,8: OSX 10.5, MorphOS 3.18
  • »27.06.18 - 13:34
    Profile