(과제)입출력 함수들 비교

2015. 3. 6. 11:12창고

728x90
728x90

1. 입력 함수 비교

scanf vs gets

scanf는 공백 단위로 문자열을 받지만 gets는 공백을 포함하여 문자열을 받는다.

gets는 변수 출력을 할 수 없다.


2. 출력 함수 비교

printf vs puts

printf와 다르게 puts는 자동으로 개행된다. 그리고 변수를 출력할 수 없다.


3. 입력 버퍼사용여부 차이점

엔터가 들어올때까지 입력을 담아둘 수 있다. Enter Key로 문자나 문자열을 리턴한다.

입력시 문자 수정 가능 여부가 결정된다.



4. stdio.h, conio.h

http://ko.wikipedia.org/wiki/Stdio.h

stdio.h은 Standard Input/Output library (표준 입출력 라이브러리)의 약어로써, C 언어의 표준 라이브러리 함수의 매크로 정의, 상수, 여러 형의 입출력 함수가 포함된 헤더 파일이다. 1970년대, 벨 연구소의 마크 레스크가 쓴 "portable I/O package"[1]로부터 내려저 왔다. C++에서는 호환성을 이유로 stdio.h 헤더 파일이 포함되어 있는 것과 마찬가지로 cstdio도 std 이름공간에서 stdio.h의 함수와 형식이 선언되어 있다.

http://en.wikipedia.org/wiki/Conio.h

conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output. It is not part of the C standard library or ISO C, nor is it defined by POSIX.This header declares several useful library functions for performing "console input and output" from a program. Most C compilers that target DOS, Windows 3.x, Phar Lap, DOSX, OS/2, or Win32 have this header and supply the associated library functions in the default C library. Most C compilers that target UNIX and Linux do not have this header and do not supply the library functions. Some embedded systems use a conio-compatible library.



728x90
반응형