The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Human readable type vs MIME type detection using file spauldingsmails Shell Programming and Scripting 0 03-21-2007 09:43 PM
Need help in choosing Unix Platform. justanoob UNIX for Dummies Questions & Answers 3 03-10-2005 12:45 AM
Porting of Windows written unix scripts to unix platform tamilselvi UNIX for Advanced & Expert Users 7 10-02-2002 07:55 AM
How to programm TTY devices under UNIX platform? WayneYang High Level Programming 8 12-28-2001 02:15 AM
C++ on True Unix Platform mandar3 High Level Programming 2 10-15-2001 08:13 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-07-2007
Registered User
 

Join Date: May 2007
Posts: 14
Platform type in Unix

Hi all,

How does one get the platform type in UNIX (for e.g. sparc/i386)? I need an function call and not the command like uname -p.

thanks!
Reply With Quote
Forum Sponsor
  #2  
Old 06-07-2007
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,698
See if you have the uname system call available on your machine. Check for man 2 uname
Reply With Quote
  #3  
Old 06-07-2007
Registered User
 

Join Date: May 2007
Posts: 14
It is there but it doesn't give platform type/architecture
Reply With Quote
  #4  
Old 06-07-2007
ilko_partizan's Avatar
Registered User
 

Join Date: Apr 2007
Location: EU, Bulgaria
Posts: 33
You are seeing a following example.

Code:
#include <sys/utsname.h>

main()
{
    struct utsname sys_inf;

    uname(&sys_inf);

    printf("System name - %s \n", sys_inf.sysname);
    printf("Nodename    - %s \n", sys_inf.nodename);
    printf("Release     - %s \n", sys_inf.release);
    printf("Version     - %s \n", sys_inf.version);
    printf("Machine     - %s \n", sys_inf.machine);
}
Best regards,
Iliyan Varshilov

Last edited by ilko_partizan; 06-07-2007 at 01:37 AM.
Reply With Quote
  #5  
Old 06-07-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by slash_blog
e.g. sparc/i386 .... I need an function call
Does this mean you are running compiled code? If so you should already know what architecture, or at least the compiler does.

For example, a C compiler may predefine one of the following as #defines:

__ppc__
__386__
__x86_64__
__mips__
__sparc__ or __sparc
__hppa
__alpha

Also, look at "config.guess"
Reply With Quote
  #6  
Old 06-07-2007
Registered User
 

Join Date: May 2007
Posts: 14
Quote:
Originally Posted by ilko_partizan
You are seeing a following example.

Code:
#include <sys/utsname.h>

main()
{
    struct utsname sys_inf;

    uname(&sys_inf);

    printf("System name - %s \n", sys_inf.sysname);
    printf("Nodename    - %s \n", sys_inf.nodename);
    printf("Release     - %s \n", sys_inf.release);
    printf("Version     - %s \n", sys_inf.version);
    printf("Machine     - %s \n", sys_inf.machine);
}
Best regards,
Iliyan Varshilov

But none of them gives processor architecture
Reply With Quote
  #7  
Old 06-07-2007
Registered User
 

Join Date: Jun 2007
Location: Namibia
Posts: 9
how do i remove this -l

-rw-r--r-- 1 ananias ananias 2050 Jun 5 12:59 -l

how do i remove such a filename -l, that i exdentaly created but if u do ls -al it say it cannot open and it i say cat -l
cat: illegal option -- l
usage: cat [-benstuv] [file ...]
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0