system() call output not seen in text mode

This is a discussion on system() call output not seen in text mode within the Linux Programming forums, part of the Platform Specific Boards category; Good day to you all Perhaps you might help me with a little problem? I am calling a binary from ...

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    1

    system() call output not seen in text mode

    Good day to you all

    Perhaps you might help me with a little problem?

    I am calling a binary from my console c program.
    Code:
       printf("result of ls\n");
       system("ls -lh");
       ...
    When the code is executed from terminal emulator in X, i see ls's output.
    But when i run in text mode, i get no output.

    How come?

    PS:
    I understand that system() spawns another shell with fork, right?
    And maybe its sort of inherits the shell environment from terminal emulator in X,
    and its stdout among other things.
    But it doesn't in text mode? Or what?

    PPS:
    I cant use popen(), becouse i dont want to handle the output myself, ie
    if i run system("man something") its man's job to fit its output in terminal, and wait
    for up, down, home etc, and i dont want to do it manualy.

    Thanks alot.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    What do you call "text mode"?

    X-term, or any other kind of pseudo terminal (or real terminal for that matter) should be pretty much the same as far as your program is concerned.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  2. temperature sensors
    By danko in forum C Programming
    Replies: 22
    Last Post: 07-10-2007, 07:26 PM
  3. output text to hyperterminal
    By baseball07 in forum Networking/Device Communication
    Replies: 3
    Last Post: 04-25-2007, 09:49 PM
  4. Replies: 4
    Last Post: 06-13-2005, 09:03 AM
  5. Pls help me to do this project in C I need source code
    By sureshmenon74 in forum C Programming
    Replies: 4
    Last Post: 10-04-2001, 06:57 AM

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