LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 803|回复: 2

同样的程序,在UNIX不能通过?

[复制链接]
发表于 2004-4-26 18:05:43 | 显示全部楼层 |阅读模式

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main( void )
  4. {
  5.     FILE *fp;
  6.     int c;
  7.     fp = fopen( "/root/fstab", "r" );
  8.     if( fp != NULL ) {
  9.         c = fgetc( fp );
  10.         if( ferror( fp ) ) {
  11.             printf( "Error reading file\n" );
  12.         }
  13.     }
  14.     fclose( fp );
  15.     return EXIT_SUCCESS;
  16. }
复制代码


能在RedHat 9通过,在BSD应该怎么写?
发表于 2004-4-26 19:03:40 | 显示全部楼层
有什么错误提示,贴上来呀!
 楼主| 发表于 2004-4-26 21:44:53 | 显示全部楼层
用-c参数能通过,但编译是就有
/tmp/cat*o
等。
就只有这样的提示,没有具体说错在那里!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表