Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- context switch
- jenkins
- 문자형 디바이스 파일
- 환경 변수
- context
- activities
- HDR
- interrupt handler
- 디스크 축소
- gparted
- intents
- fprintf
- 프레임버퍼
- 소캣
- memcmp
- ubuntu
- sscanf
- Shared Folder
- makefile
- 젠킨스
- usb2.0
- DMA
- layouts
- fscanf
- pagefile.sys
- 속도저하
- 멀티프로세싱
- 디스크립터
- interrupt context
- sprintf
Archives
- Today
- Total
do{학습}while
c) fprintf() 본문
기능 요약
특정한 스트림에 일련의 데이터를 특정한 형식에 맞추어 파일에 입력
헤더파일
#include <stdio.h> //c++: <cstdio>
원형
int fprintf(FILE* stream, const char* format, ...);
주의 사항
예시 코드
#include <stdio.h>
int main() {
FILE* fp = fopen("output.txt", "w");
int integer = 123;
char character = 'c';
char string[] = "hello, world";
int* pointer = &integer;
double pi = 3.141592;
fprintf(fp, "integer : (decimal) %d (octal) %o \\n", integer, integer);
fprintf(fp, "character : %c \\n", character);
fprintf(fp, "string : %s \\n", string);
fprintf(fp, "pointer addr : %p \\n", pointer);
fprintf(fp, "floating point : %e // %f \\n", pi, pi);
fprintf(fp, "percent symbol : %% \\n");
fclose(fp);
return 0;
}'C & C++ > c언어 표준함수' 카테고리의 다른 글
| c) memcmp() (0) | 2024.05.27 |
|---|---|
| c) sscanf() (0) | 2024.05.27 |
| c) sprintf() (0) | 2024.05.27 |
| c) fscanf() (0) | 2024.05.27 |
| c) strdup() (0) | 2024.05.27 |