-
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
-
-
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.
-
-
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!
-
-
This is a fun program to figure out, for anyone with the inclination.
-