gsa*_*ras -1 c linux io posix file
我试图在一个文件中写一个4个无符号整数的结构,然后再读回来,但我什么都看不懂.
这是我的代码:
// create and write values in superblock
..
Superblock s; // the struct
if(write(file_desc , &superblock , sizeof(Superblock)) == -1) {
  perror("writing superblock");
  exit(1);
}
close(file_desc);
file_desc = open(path_file, O_WRONLY | O_CREAT, 0600);
while ( ( read( file_desc , &s , sizeof(Superblock))) > 0 ) {
  printf("%u %u %u %u\n", s.block_size, s.filename_size, s.max_file_size,
         s.max_dir_file_no);
}
它甚至不会进入循环.我错过了什么?
| 归档时间: | 
 | 
| 查看次数: | 76 次 | 
| 最近记录: |