Internet usage computation program
An application to check current Internet usage
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
//////////////////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
//////////////////////////////////////////////////
int main(void)
{
unsigned long bytes_sent, bytes_received; /*You can use unsigned long long */
FILE *temp_file;
system("netstat -e > usage.in"); /* Sending Output to a temporary File */
temp_file = fopen("usage.in","r");
fscanf(temp_file,"%*s%*s%*s%*s%*s%llu%llu",&bytes_received, &bytes_sent);
printf("%s","Your net usage statistics:(This Session)\n");
printf("%s","------------------------------------------\n\n");
printf("%s%8.3f MB\n","Sent: ", (((double)bytes_sent) / ((double)(1024 * 1024))));
printf("%s%8.3f MB\n","Received: ", (((double)bytes_received) / ((double)(1024 * 1024))));
printf("%s%8.3f MB\n\n","Total: ", (((double)(bytes_sent + bytes_received)) / ((double)(1024 * 1024))));
system("pause");
fclose(temp_file);
system("del usage.in"); /* Deleting the temporary File */
return 0;
}
//////////////////////////////////////////////////
Original Comments (3)
Recovered from Wayback Machine