Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
open()の戻り値は-1であり、perror()を使用してエラーを見つけようとすると、出力は「ファイルが存在します」でした。
エラーまたはファイルが開かない理由を見つけるにはどうすればよいですか。
のように見える
EEXIST パス名が既に存在し、O_CREAT と O_EXCL が使用されました。
以下に説明するように、おそらく引用符でマクロを指定したはずです。
fd = open(filename、 "O_RDONLY");
引用符なしである必要がありfd = open(filename,O_RDONLY);ます。
fd = open(filename,O_RDONLY);