int main(int argc, char ** argv) { HDD hdd(argv[1]); test_hdd(&hdd); Ext2FS * fs = new Ext2FS(hdd, 1); test_file_system(fs); test_block_groups(fs); // ejercicio 2 unsigned char * buffer = new unsigned char[18]; fd_t fileDesc = fs->open("/grupos/g15/nota.txt", ""); fs->seek(fileDesc,13999); fs->read(fileDesc, buffer, 17); buffer[17] = '\0'; cout << buffer << endl; //delete[] buffer; return 0; }
int main(int argc, char ** argv) { HDD hdd(argv[1]); Ext2FS * fs = new Ext2FS(hdd, 1); fd_t file = fs->open("/grupos/g17/nota.txt", "r"); int pos = fs->seek(file, 13999); printf("Seek pos:%d\n", pos); unsigned char buffer[17]; int leidos = fs->read(file, buffer, 17); printf("Leidos: %d\n", leidos); printf("Texto: %s\n", buffer); fs->close(file); return 0; }