라벨이 stdio.h인 게시물 표시

C 언어: sprintf 함수

C언어: 출력 /// 헤더파일 #include <stdio.h> /// 함수원형 int sprintf (char * s, const char * format, ...) /// 인자 const char * format, …: 문자열(과 문자열안의 서식 지정자에 관련된 값) /// 반환값 성공시 반환값(return value): 출력 문자열의 문자 수(Byte 수) 오류시 반환값(return value): 음수 /// 참고파일 헤더파일: stdio.h(연결) 헤더파일: stdio.h(연결) 소스파일: sprintf.c(연결) reference https://man7.org/linux/man-pages/man3/sprintf.3p.html /// 예제 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 #include   < stdio.h >   #define  BUFFER_SIZE  100   // 프로그램의 목적을 충분히 생각해봅시다.   int  main( void ) {      char  Undefined_Way[BUFFER_SIZE];      char  Defined_Way[BUFFER_SIZE];      char  Mysterious[BUFFER_SIZE];      char  Mysterious_Door[BUFFER_SIZE];      char  Invisible_Teleporter[BUFFER_SIZE];         printf ( "------ Input Contents(to a memory)------\n" );         printf ( "1th return value is %d\n" , sprintf(Undefined_Way,  "Nothing ---> (mysterious) ---> Something&quo

C 언어: printf 함수

C언어: 출력 /// 헤더파일 #include <stdio.h> /// 함수원형 int printf (const char * format, ...); /// 인자 const char * format, ...: 문자열(과 문자열안의 서식 지정자에 관련된 값) /// 반환값 성공시 반환값(return value): 출력 문자열의 문자 수(Byte 수) 오류시 반환값(return value): 음수 /// 참고파일 헤더파일: stdio.h(연결) 헤더파일: stdio.h(연결) 소스파일: printf.c(연결) reference https://man7.org/linux/man-pages/man1/printf.1.html /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include   < stdio.h >   int  main( void ) {     puts( "------ Move Contens to a memory for stdout ------" );     puts( "------ In case of line buffered or fully buffered ------" );        printf ( "return value is %d \n" ,  printf ( "1. %d " ,  777 ));      printf ( "return value is %d \n" ,  printf ( "2. %f " ,  0. 5 ));      printf ( "return value is %d \n" ,  printf ( "3. %s " ,  "'String'" ));      printf ( "return value is %d \n" ,  printf ( "4