메모

저수준 파일입출력 함수

romance penguin 2017. 1. 12. 02:07
반응형

#include <io.h>

#include <fcntl.h>



int _open(const char *filename, int oflag); //성공 fd리턴


int _close(int fd); //성공 0리턴


_O_BINARY -바이너리

_O_TEXT -텍스트

_O_RDONLY -읽기전용

_O_WRONLY -쓰기전용

_O_RDWR -읽기기

_O_APPEND -커서를 맨끝으로

_O_CREAT -새로파일 생성

_O_SHORT_LIVE -임시파일

_O_TEMPORARY -close할때 파일 삭제


oflag값은 |로 여러개 줄수 있다.



입출력함수


int _read(int fd,void *buf,unsigned int count); //count만큼 버퍼로 읽음


int _write(int fd,const void *buf,unsigned int count); //count만큼 버퍼로 씀


성공시 count리턴


임의접근

long _lseek(int fd,long offset,int origin);

long _tell(int fd);

반응형