读取文件内容

//
//  main.c
//  读取文件的内容
//
//  Created by zhang on 16/4/10.
//  Copyright © 2016年 jin. All rights reserved.
//

#include <stdio.h>
/**
 输出文件包含的内容
 */
void test1()
{
    FILE *file = fopen("/Users/zhang/xcode/算法与数据结构/读取文件的内容/test.h", "r");
    //    file = fopen("test.h", "r");
    if (file != NULL) {
        char temp;
        while (fscanf(file, "%c",&temp) != EOF) {
            printf("%c",temp);
        }
        fclose(file);
    }
}

int main(int argc, const char * argv[]) {

    return 0;
}

标签: c

添加新评论