当前位置:网站首页>C language fcntl function
C language fcntl function
2022-07-03 14:40:00 【ma_ de_ hao_ mei_ le】
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
int fd = open("a.txt", O_RDWR);
char buf[12138] = {
0};
// Writing again at this time is additional writing
read(fd, buf, 12138);
printf(" Original content :%s\n", buf);
// Get the original flag And plus O_APPEND flag
int flag = fcntl(fd, F_GETFL) | O_APPEND;
// Set up flag
fcntl(fd, F_SETFL, flag);
char* str = "\tafter append";
// Writing again at this time is additional writing
write(fd, str, strlen(str));
close(fd);
fd = open("a.txt", O_RDWR);
read(fd, buf, 12138);
printf(" Additional content :%s\n", buf);
return 0;
}
边栏推荐
- Common commands for getting started with mongodb database
- Puzzle (016.3) is inextricably linked
- NOI OPENJUDGE 1.5(23)
- Zzuli:1048 factorial table
- 【7.3】146. LRU caching mechanism
- Tonybot humanoid robot infrared remote control play 0630
- tonybot 人形机器人 红外遥控玩法 0630
- 556. The next larger element III: simple construction simulation questions
- Luogu p3065 [usaco12dec]first! G problem solution
- Dllexport and dllimport
猜你喜欢
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
Why is this error reported when modifying records in the database
Tonybot humanoid robot starts for the first time 0630
Frequently asked questions: PHP LDAP_ add(): Add: Undefined attribute type in
tonybot 人形机器人 红外遥控玩法 0630
Pyqt interface production (login + jump page)
Tonybot Humanoïde Robot Infrared Remote play 0630
洛谷P5018 [NOIP2018 普及组] 对称二叉树 题解
Talking about part of data storage in C language
Sub GHz wireless solution Z-Wave 800 Series zg23 SOC and zgm230s modules
随机推荐
Luogu p5194 [usaco05dec]scales s solution
Sword finger offer 28 Symmetric binary tree
Common shortcut keys in PCB
7-23 currency conversion (using array conversion)
Protobuf and grpc
1017 a divided by B (20 points)
tonybot 人形機器人 紅外遙控玩法 0630
Zzuli:1057 prime number determination
556. The next larger element III
Puzzle (016.4) domino effect
How Facebook moves instagram from AWS to its own server
Zzuli:1041 sum of sequence 2
C language to implement a password manager (under update)
Use of form text box (I) select text
Zzuli:1054 monkeys eat peaches
ConstraintLayout 的使用
Tonybot Humanoïde Robot Infrared Remote play 0630
洛谷P5194 [USACO05DEC]Scales S 题解
Dllexport et dllimport
Find books ()