嗨,我对指针有一个非常令人沮丧的问题,有人可以让我知道我在这里做错了什么。谢谢
// This functions reads from the file
void get__data_block_from_disk(char* ptr, int block_num){
int file_desc;
int x;
open_fs(file_path);
file_desc = fileno(fileptr);
x = lseek(file_desc, DATA_BLOCK_OFFSET + block_num*BLOCK_SIZE, SEEK_SET);
fread(&ptr, BLOCK_SIZE, 1, fileptr);
close_fs();
}
// This function writes to the file
void place__data_block_into_disk(char* ptr, int block_num){
int file_desc;
int x;
printf("char in place: %c\n", ptr);
open_fs(file_path);
file_desc = fileno(fileptr);
x = lseek(file_desc, DATA_BLOCK_OFFSET + block_num*BLOCK_SIZE, SEEK_SET);
fwrite(ptr, BLOCK_SIZE, 1, fileptr);
close_fs();
}