Inializing variables by commands

This is a discussion on Inializing variables by commands within the Linux Programming forums, part of the Platform Specific Boards category; How could you, for example, set the inode of a file to a variable? Code: //something like this? a = ...

  1. #1
    _ Munkey01's Avatar
    Join Date
    Dec 2002
    Posts
    280

    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 09: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, 03: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, 08:13 PM

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