Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 27th, 2007, 07:29 PM
Authorized User
 
Join Date: Jun 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default C / C++ & OS

Dear programmers.
I'm new in C / C++ programming and I want to write program which output the information of OS (Windows / Unix / Mac - Username - Domain name ...). Dose anyone knows how to do this?


Thanks
Best Regards
ManiH.

Reply With Quote
  #2 (permalink)  
Old June 29th, 2007, 07:23 AM
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TotcoS Send a message via MSN to TotcoS Send a message via Yahoo to TotcoS
Default

The only thing I can think of is using system().

Code:
#include <iostream>
using namespace std;

int main() {
    system("set");
    cout << endl;
    cin.get();
    return(0);
}
I don't need a signature =D
Reply With Quote
  #3 (permalink)  
Old July 14th, 2007, 11:32 AM
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TotcoS Send a message via MSN to TotcoS Send a message via Yahoo to TotcoS
Default

Quote:
quote:Originally posted by manih
 Dear programmers.
I'm new in C / C++ programming and I want to write program which output the information of OS (Windows / Unix / Mac - Username - Domain name ...). Dose anyone knows how to do this?


Thanks
Best Regards
ManiH.

Code:
#include <iostream>
using namespace std;

int main(){
    cout << "WHOAMI: ";
    system("echo %USERNAME%");
    cout << "OS: ";
    system("echo %OS%");
    system("pause");
}
I don't need a signature =D
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript & Safari (On MAC OS) usman_iftikhar Javascript 2 October 1st, 2006 11:01 PM
Javascript && keeps turnig into &amp;&amp; ayrton Pro VB.NET 2002/2003 3 June 27th, 2005 03:34 PM
Linux & KDE & C++ & QT & MYSQL & Kdevelop Munnnki Linux 0 January 2nd, 2005 05:41 PM
OS chaos2003 Linux 1 August 26th, 2003 12:12 PM
JRun4 for Mac OS + Mac OS X's Java 1.4.1 elbicho J2EE 0 June 27th, 2003 12:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.