关于 fopen

f2bin 2001-09-07 03:42:25
在C中fopen一个文件,报 libc internal error:
_rmutex_unlock: rmutex not held 何故?
...全文
123 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
f2bin 2001-09-10
  • 打赏
  • 举报
回复
to xwu(蛮牛) :不行耶 ,:(
to fsb_12345(myself) :谢谢你的例子,不过我要得不是这个。:(
to scklotz(晓春) :SUN Solaris ,workshop 4.2.
onetwothree 2001-09-08
  • 打赏
  • 举报
回复
fsb_12345(myself):你用文本方式打开文件,后用二进制方式读写,这样做有问题!请想想。
scklotz 2001-09-08
  • 打赏
  • 举报
回复
vc or tc ?
cmpp 2001-09-07
  • 打赏
  • 举报
回复
我来学习一下!
cmpp 2001-09-07
  • 打赏
  • 举报
回复
我来学习一下!
cmpp 2001-09-07
  • 打赏
  • 举报
回复
我来学习一下!
fsb_12345 2001-09-07
  • 打赏
  • 举报
回复
#include <string.h>
#include <stdio.h>

int main(void)
{
FILE *stream;
char msg[] = "this is a test";
char buf[20];

if ((stream = fopen("DUMMY.FIL", "w+"))
== NULL)
{
fprintf(stderr,
"Cannot open output file.\n");
return 1;
}

/* write some data to the file */
fwrite(msg, strlen(msg)+1, 1, stream);

/* seek to the beginning of the file */
fseek(stream, SEEK_SET, 0);

/* read the data and display it */
fread(buf, strlen(msg)+1, 1, stream);
printf("%s\n", buf);

fclose(stream);
return 0;
}
xwu 2001-09-07
  • 打赏
  • 举报
回复
Compile with option "-mt".

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧