Thread: Inializing variables by commands

  1. #1

    Inializing variables by commands

    How could you, for example, set the inode of a file to a variable?

    Code:
    //something like this?
    a = system("ls -i text.txt");
    And also, since this is a Linux forum. How do you change your shell? Like from BASH to SH or CSH?
    Last edited by Munkey01; 04-22-2003 at 08:46 PM.

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    You may want to read the manpage on system. It does not do what you think it does.

  3. #3
    cgoat
    Guest
    popen() and pclose() are useful for reading in the output from system commands into your program. It works just like reading from a file.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Father and Son Variables
    By khdani in forum Linux Programming
    Replies: 3
    Last Post: 11-28-2008, 06:42 PM
  2. Replies: 15
    Last Post: 09-30-2008, 02:12 AM
  3. esbo's data sharing example
    By esbo in forum C Programming
    Replies: 49
    Last Post: 01-08-2008, 11:07 PM
  4. Creating local variables in a program?
    By fl0at in forum C Programming
    Replies: 5
    Last Post: 01-04-2008, 07:34 PM
  5. static variables
    By Luigi in forum C++ Programming
    Replies: 4
    Last Post: 04-24-2003, 07:13 PM