More Related Content
詳解UNIXプログラミング 第4章 ファイルとディレクトリ 32 Ways a Digital Marketing Consultant Can Help Grow Your Business Featured (20)
2024 Trend Updates: What Really Works In SEO & Content Marketing Storytelling For The Web: Integrate Storytelling in your Design Process Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis... How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR... 2024 State of Marketing Report – by Hubspot Everything You Need To Know About ChatGPT Product Design Trends in 2024 | Teenage Engineerings How Race, Age and Gender Shape Attitudes Towards Mental Health AI Trends in Creative Operations 2024 by Artwork Flow.pdf PEPSICO Presentation to CAGNY Conference Feb 2024 Content Methodology: A Best Practices Report (Webinar) How to Prepare For a Successful Job Search for 2024 Social Media Marketing Trends 2024 // The Global Indie Insights Trends In Paid Search: Navigating The Digital Landscape In 2024 5 Public speaking tips from TED - Visualized summary ChatGPT and the Future of Work - Clark Boyd Getting into the tech field. what next Google's Just Not That Into You: Understanding Core Updates & Search Intent How to have difficult conversations Unix5
- 7. ストリームのオープン
FILE *fopen(const char *pathname, const char *type);
FILE *freopen(const char *pathname, const char
*type, FILE *fp);
FILE *fdopen(int filedes, const char *type);
fopen 指定したファイルをオープンする
freopen ストリームを指定し、既にオープンさ
れていたらそれをクローズしてからファイルを
オープン
fdopen open,dup,pipeなどで取得したfiledesを
受け取り、それを標準入出力ストリームへ結
びつける
- 9. 文字単位の出力関数
int putc(int c, FILE *fp);
int fputc(int c, FILE *fp);
int putchar(int c);
getchar <=> getc(stdin)と同様、
putchar<=>putc(stdin)
getc,putcはマクロでfgetc,fputcは関数=>関数だ
とアドレスがとれるので別の関数の引数にでき
る
- 10. 行単位の入出力
char *fgets(char *buf, int n, FILE *fp);
char *gets(char *buf);
int fputs(const char *str, FILE *fp);
int puts(const char *str);
fgetsはバッファサイズnも指定する
getsはバッファサイズを指定できないので有名
なセキュリティホールが存在
fgetsとfputsを使えば改行文字を意識しないで
済む
- 12. 書式付き出力
int printf(const char *format, ....);
int fprintf(FILE *fp, const char *format, ...);
int sprintf(char *buf, const char *format, ...);
printfは標準出力に書き込む
fprintfは指定したストリームに書き込む
sprintfは書式付けした結果を配列bufに収める