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.
関数と同じようにファイルを開いたhell.txtとしopen()ます。
hell.txt
open()
fd=open("hell.txt",O_RDONLY);
次に、記述子を として返すと考えて4ください。hi.txtすでに記述子を占有しているので、または関数を使用せずに ファイル3を接続したい。hell.txt3dup2fcntl()
4
hi.txt
3
dup2
fcntl()
その2つの機能を使わずに変更することは可能ですか?
通常、ファイル記述子は最初に最小の番号で占有されるため、これは通常は機能します。
close(3); fd=open("hell.txt",O_RDONLY);