⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fopen_example.c.c

📁 linux下的程序开发(C语言实现):本程序主要实现文件的操作
💻 C
字号:
//open file try.txt with readonly mode;.on failure print "fail to open file!" then return; otherwise print "open file successfully” then close the opened file
#include<stdio.h>
int main(int argc,char *argv[])
{
    FILE *fp=NULL;
    fp=fopen("try.txt","r"); 				//以只读形式打开文件try.txt
    if(fp==NULL) 					//不成功则输出"fail to open file!\n"
    {
        printf("fail to open file!\n"); 
        return -1;
    }
    printf("open file successfully!\n");
    fclose(fp); 					//关闭已打开的文件
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -