Thread: popen for linux cmd output

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    Why don't you do the thing id does by yourself? It will be quite a lot simpler and cleaner. getuid(2) and geteuid(2).

  2. #2
    Registered User
    Join Date
    Jun 2010
    Posts
    18
    Thanks fronty for your suggestion. Its working with the function getuid(). Is root's uid (0) same in all linux flavours?

    Also can some one let's know, why length of ch is 5? why not 4?

  3. #3
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    fgets() reads in at most one less than size characters from stream and
    stores them into the buffer pointed to by s. Reading stops after an
    EOF or a newline. If a newline is read, it is stored into the buffer.
    A '\0' is stored after the last character in the buffer.
    There from man fgets.

  4. #4
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    Quote Originally Posted by sangamesh View Post
    Is root's uid (0) same in all linux flavours?
    Super user's uid is 0 on all posix-ish operating systems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. code output...
    By roaan in forum C Programming
    Replies: 6
    Last Post: 07-03-2009, 02:22 AM
  2. Help for my output array
    By qwertysingh in forum C Programming
    Replies: 1
    Last Post: 02-17-2009, 03:08 PM
  3. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 03:29 PM
  4. Control different DA output value!
    By Hunterhunter in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-13-2003, 12:11 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 05:27 AM