fopen和fopen64返回值类型有什么不同?

软件和网站开发以及相关技术探讨
回复
VisionMiracle
帖子: 42
注册时间: 2006-08-20 8:20

fopen和fopen64返回值类型有什么不同?

#1

帖子 VisionMiracle » 2006-09-04 14:09

为什么用文件指针接收前者的返回值就没问题
接收fopen64编译就出警告:
把整数赋值给文件指针,未作类型转换
运行有时候没问题
有时会出错: 段错误。
lpknnkh
帖子: 54
注册时间: 2006-02-07 18:07

#2

帖子 lpknnkh » 2006-09-09 19:16

fopen returns FILE*, stream.
fopen64 returns int, file descriptor
上次由 lpknnkh 在 2006-09-10 7:54,总共编辑 1 次。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#3

帖子 eexpress » 2006-09-09 19:39

这些应该看manpages

FOPEN(3) Linux Programmer’s Manual FOPEN(3)

NAME
fopen, fdopen, freopen - 打开流

SYNOPSIS 总览
#include <stdio.h>

FILE *fopen(const char *path, const char *mode);
FILE *fdopen(int fildes, const char *mode);
FILE *freopen(const char *path, const char *mode, FILE *stream);
● 鸣学
回复