Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned int GET_DEVICES(){
- FILE *devices;
- int size_files, i;
- char *buffer = (char*)malloc(1), charac;
- printf(".-----------------------------------------------------------------.\n"); //remove this
- printf("! Devices ! Partition Table ! Size ! Sector(Physical/Logical) !\n"); //remove this
- printf("!-----------------------------------------------------------------!\n"); //remove this
- devices = fopen("/proc/partitions", "r");
- fseek(devices, 0L, SEEK_END);
- buffer = (char*)realloc(buffer, ftell(devices)+1);
- fseek(devices, 0L, SEEK_SET);
- charac = fgetc(devices);
- for(i=0;charac!=EOF;i++){
- buffer[i] = charac;
- charac = fgetc(devices);
- }
- buffer[i-1] = '\0';
- fclose(devices);
- printf("%s\n", buffer);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement