asm_book/section_1/funcs/fo.cpp
2022-12-26 08:34:19 -06:00

16 lines
No EOL
280 B
C++

#include <iostream>
#include <unistd.h>
#include <fcntl.h>
using std::cout;
using std::endl;
using std::hex;
int main() {
int fd = open("test.txt", O_RDWR | O_CREAT, 0666);
cout << fd << endl;
cout << hex << (O_RDWR | O_CREAT) << endl;
if (fd >= 0)
close(fd);
return 0;
}