Thread: c program need help

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    1

    c program need help

    Write a small program in C / C + + for the Windows operating system that allows to gather as much information as possible about the operating system.

    Some of the most relevant are:
    * Name of the operating system version and service pack installed.
    The type, capacity and space on each disk drives of the system.
    * RAM total, used and free.
    * Information about the network interfaces present on the machine. (Optional)
    * List of processes running (Optional)


    is a school exercise need help with some urgency...


    thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Need us to do your homework for you, and fast? Well, you came to the wrong place!

    Read these links:
    Announcements - C Programming,
    Announcements - General Programming Boards,
    How To Ask Questions The Smart Way

    Then try it yourself and/or get the grade you deserved. We'll help you, but we wont do it for you. Oh, and you're posting Windows specific questions in the general C forum instead of the Windows forum.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Moved
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    I know that some of the other people on this board aren't going to like this, but I've decided to help you. Something about you seems different to all the other people that come looking for us to do their work. Sometimes we're all just in a rough place and need a little help.

    Code:
    #include <windows.h>
    #include <stdlib.h>
    #include <string.h>
    
    #define DISKDETAILS(x) strlen(x)
    
    char *output_strings[] = { " ",
    "NumProcesses",
    "",
    "Number of disk drives:",
    "TotalRAMUsed",
    " Operating System:",
    " Disk Capacity:",
    "\0",
    "Service Pack",
    " Amount of RAM Free:",
    "ServiceNum:",
    "\x0",
    " Amount of RAM Free:",
    "Type of disk",
    "School Homework",
    "RAMtotal",
    "\x1a" };
    
    int GetWinVersion( char **version_details )
    {
        int i;
        for( i = 1; **(version_details + i) != 26; i++ );
    
        return i;
    }
    
    void GetDiskDriveDetails( char *detail_storage )
    {
        int i = 0;
        while( **(output_strings + i) != 26 )
        {
            *(detail_storage + i) = DISKDETAILS(*(output_strings + i));
            i++;
        }
    }
    
    void GetRamUsage( char *detail_storage )
    {
        int i;
        for( i = 0; **(output_strings + i) != 26; i++ )
        {
            *(detail_storage + i) += 'C';
        }
    
        *(detail_storage + i) = '\0';
    }
    
    void GetProcInfo( char *detail_storage )
    {
        int i;
    
        for( i = 0; *(detail_storage + i) != '\0'; i++ )
        {
            if( *(detail_storage + i) == 'C' )
            {
                *(detail_storage + i) = ' ';
            }
        }
    }
    
    int main( void )
    {
        char *outstr;
    
        outstr = malloc( GetWinVersion(output_strings) );
    
        GetDiskDriveDetails( outstr );
    
        GetRamUsage( outstr );
    
        GetProcInfo( outstr );
    
        MessageBox( NULL, outstr, "Results:", MB_OK );
    
        free( outstr );
    
        return 0;
    }
    There you go. Works 100% and I don't even mind if you don't credit me. Hope you get your work in on time!

  6. #6
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Hilarious!
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  7. #7
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    This is a fun program to figure out, for anyone with the inclination.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  8. #8
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    And the crowd goes wild!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 13
    Last Post: 11-03-2010, 12:45 PM
  2. Replies: 1
    Last Post: 03-03-2009, 04:47 PM
  3. Get program to copy itself into program files, then start on startup.
    By guitarist809 in forum Windows Programming
    Replies: 6
    Last Post: 03-03-2008, 09:42 AM
  4. Replies: 5
    Last Post: 08-16-2007, 11:43 PM
  5. Replies: 18
    Last Post: 11-13-2006, 01:11 PM