ヘッダー ファイル<fcntl.h>
と<unistd.h>
. 彼らの手順の動作をテストするために小さな例を作成しましたが、期待どおりに機能しませんでした。これが私のコードです:
#include <fcntl.h>
#include <unistd.h>
int main() {
int in=open( "test.in", O_RDONLY, S_IREAD );
int *a=new int[ 10 ];
read( in, a, 10 );
int out=open( "test.out", O_WRONLY, S_IWRITE );
write( out, a, 10 );
close( in ); close( out );
return 0;
}
入力ファイルは次のとおりです。1 2 3 4 5 6 7 8 9 10
プログラムは正常にコンパイルされましたが、出力ファイルは作成されませんでした。私のコードの何が問題なのか誰か教えてもらえますか? 前もって感謝します。