标题:各位高手帮看一下哪错了,谢谢
取消只看楼主
呵呵呵。。
Rank: 2
等 级:论坛游民
帖 子:43
专家分:52
注 册:2010-6-11
结帖率:88.89%
已结贴  问题点数:20 回复次数:0 
各位高手帮看一下哪错了,谢谢
#include <stdio.h>
#include <stdlib.h>
void main()
{
    int i=3;
    float f=6.2;
   
    FILE *fp;

    if((fp=fopen("wang.txt","w"))==NULL)
    {
        printf("can't create file: wang.txt\n");
        exit(0);
    }
    fprintf(fp,"%2d,%6.2f",i,f);
    fclose(fp);

    if((fp=fopen("wang.txt","r"))==NULL)
    {
        printf("can't openfile:wang.txt\n");
        exit(0);

    }
    i=0;f=0;
    fcanf(fp,"%2d,%6.2f",&i,&f);
    fclose(fp);

    printf("i=%2d,f=%6f\n",i,f);
}
搜索更多相关主题的帖子: void include create file 
2011-01-14 18:45



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-331101-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.385348 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved