是的,使用
int file;
file = open("yourfile.txt", O_RDONLY | O_BINARY, 0); //change flags if necessary
Run Code Online (Sandbox Code Playgroud)
使用这些包括:
#include <fcntl.h>
#include <sys/stat.h> //for the open() permission flags
Run Code Online (Sandbox Code Playgroud)
该file
变量用于引用该文件.如果不成功,open()返回-1.
请在此处查看其他文件处理函数