Thread: How to identify Linux Platforms in C Program at Runtime

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    6

    How to identify Linux Platforms in C Program at Runtime

    Hi,

    I need to write a peice of code which is different in Linux AS2.1 and AS3.0. Both are 32 bit m/cs. How can i identify it??

    Thanks in adv,
    Molu

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    What exactly are AS and m/c?
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    I'm guessing m/c is microcontroller. Look at /proc/cpuinfo to see if there's a processor difference?

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    6
    AS refers to advance server

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    What does the processor have to do with Linux?

  6. #6
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    u can use :


    system( " uname -o ");

    the system call lets u execiute shell commands inside ur c programs.. check the man pages for "uname" and its options..
    i hope this solves ur problem

  7. #7
    ex-DECcie
    Join Date
    Dec 2005
    Posts
    125
    Basically he's looking to tell the difference between two Red Hat (I'm assuming) operating system versions.

    On RedHat, I believe if you read from /proc/version you might find a way to figure out what OS you're running....

    Your mileage may vary of course.
    Last edited by fgw_three; 06-27-2006 at 09:15 AM.
    Mr. Blonde: You ever listen to K-Billy's "Super Sounds of the Seventies" weekend? It's my personal favorite.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. Shell output into program during runtime
    By evilkillerfiggi in forum Linux Programming
    Replies: 3
    Last Post: 08-03-2006, 10:50 AM
  4. running program with arguments (linux)
    By N8760 in forum C++ Programming
    Replies: 2
    Last Post: 01-28-2002, 02:08 PM
  5. How can I debug a program in linux?
    By zahid in forum C Programming
    Replies: 5
    Last Post: 12-11-2001, 10:34 PM