본문 바로가기
C

라이브러리

by 상레알 2009. 2. 24.

conio.h    :   console input/output과 관련된 표준 라이브러리 파일


헤더파일을 열어보면

/***
*conio.h - console and port I/O declarations
*
*       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
*       This include file contains the function declarations for
*       the MS C V2.03 compatible console I/O routines.
*
*       [Public]
*
****/

#if     _MSC_VER > 1000
#pragma once
#endif

#ifndef _INC_CONIO
#define _INC_CONIO

#if     !defined(_WIN32) && !defined(_MAC)
#error ERROR: Only Mac or Win32 targets supported!
#endif


#ifndef _MAC

#ifdef __cplusplus
extern "C" {
#endif

 

/* Define _CRTIMP */

#ifndef _CRTIMP
#ifdef  _DLL
#define _CRTIMP __declspec(dllimport)
#else   /* ndef _DLL */
#define _CRTIMP
#endif  /* _DLL */
#endif  /* _CRTIMP */


/* Define __cdecl for non-Microsoft compilers */

#if     ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif

/* Define _CRTAPI1 (for compatibility with the NT SDK) */

#ifndef _CRTAPI1
#if _MSC_VER >= 800 && _M_IX86 >= 300
#define _CRTAPI1 __cdecl
#else
#define _CRTAPI1
#endif
#endif

/* Function prototypes */

_CRTIMP char * __cdecl _cgets(char *);
_CRTIMP int __cdecl _cprintf(const char *, ...);
_CRTIMP int __cdecl _cputs(const char *);
_CRTIMP int __cdecl _cscanf(const char *, ...);
_CRTIMP int __cdecl _getch(void);
_CRTIMP int __cdecl _getche(void);
#ifdef  _M_IX86
int __cdecl _inp(unsigned short);
unsigned short __cdecl _inpw(unsigned short);
unsigned long __cdecl _inpd(unsigned short);
#endif  /* _M_IX86 */
_CRTIMP int __cdecl _kbhit(void);
#ifdef  _M_IX86
int __cdecl _outp(unsigned short, int);
unsigned short __cdecl _outpw(unsigned short, unsigned short);
unsigned long __cdecl _outpd(unsigned short, unsigned long);
#endif  /* _M_IX86 */
_CRTIMP int __cdecl _putch(int);
_CRTIMP int __cdecl _ungetch(int);


#if     !__STDC__

/* Non-ANSI names for compatibility */

_CRTIMP char * __cdecl cgets(char *);
_CRTIMP int __cdecl cprintf(const char *, ...);
_CRTIMP int __cdecl cputs(const char *);
_CRTIMP int __cdecl cscanf(const char *, ...);
#ifdef  _M_IX86
int __cdecl inp(unsigned short);
unsigned short __cdecl inpw(unsigned short);
#endif  /* _M_IX86 */
_CRTIMP int __cdecl getch(void);
_CRTIMP int __cdecl getche(void);
_CRTIMP int __cdecl kbhit(void);
#ifdef  _M_IX86
int __cdecl outp(unsigned short, int);
unsigned short __cdecl outpw(unsigned short, unsigned short);
#endif  /* _M_IX86 */
_CRTIMP int __cdecl putch(int);
_CRTIMP int __cdecl ungetch(int);

#endif  /* __STDC__ */

#ifdef  __cplusplus
}
#endif

#endif  /* _MAC */

#endif  /* _INC_CONIO */



=======================================

windows.h 파일은

도스에서는 사용하는 함수에 따라 여러 개의 헤더 파일을 포함하지만

윈도우즈에서는 하나의 헤더 파일에 모든 API 함수들의 원형과 사용하는 상수들을

죄다 정의하고 있기 때문에 windows.h만 포함해 주면 됩니다.

stdio.h나 conio.h, graphics.h 등을 포함해 줄 필요가 없다는 말이죠.

물론 특별한 경우에는 해당하는 헤더 파일을 포함해야 하지만

예제 수준에서는 windows.h만 포함시키면 거의 문제가 없습니다.

windows.h 헤더 파일은 기본적인 데이터 타입, 함수 원형 등을 정의하며 그 외 필요한 헤더 파일을 포함하고 있죠..

그래서 윈도우즈 프로그램의 첫 줄은 거의 항상 #include 로 시작됩니다.

질문상에 있어 각 함수의 역할이라는 것이 바로 API함수 자체를 뜻하는 것이라

(무진장 많음 ;;) 설명하기는 무리가 있구요.

구조라는 것도 위에 말한데로 윈도우 프로그래밍을 하기위한 기본적인 것들을

포함하고 있는 헤더 파일입니다.
( 터보씨는 안되고 MS비주얼스투디오 는 됨..)

'C' 카테고리의 다른 글

재지정( redirection) 이란  (0) 2010.11.23
포인터 개념  (0) 2010.06.11
공백포함 문자 입력  (0) 2009.05.07
구조체 포인터...  (0) 2009.04.07
파일 접근 모드  (0) 2009.03.31
C 라이브러리 제작? 사용  (0) 2009.02.24
연산자 우선순위  (0) 2009.02.16
조건부 컴파일 #if #elif #else #endif  (0) 2009.02.11
type redefinition 오류 해결법  (0) 2009.02.11
LValue 와 RValue 차이점  (0) 2009.02.10