no swim no life
readv, writev 벡터 입출력 본문
read, write와 기본적으로 동일하나, 다수의 버퍼의 데이터를 한번에 출력/기록 할 수 있다.
Prototype
int writev( int fd, struct iovec iov[], int iovcount );
int readv( int fd, struct iovec iov[], int iovcount );
struct iovec {
caddr_t iov_base; // 버퍼의 시작 포인터
int lov_len; // 버퍼의 바이트 사이즈
}
struct iovec iov[3];
iov[0].iov_base = buf1;
iov[0].iov_len = strlen(buf1);
iov[1].iov_base = buf2;
iov[1].iov_len = strlen(buf2);
iov[2].iov_base = buf3;
iov[2].iov_len = strlen(buf3);
writev( fd, &iov[0], 3 );
'work > fundamental' 카테고리의 다른 글
CODE complete, 14: 직선형 코드 구성하기, 15: 조건문 사용 (0) | 2009.02.17 |
---|---|
fork, exec, system 프로세스 관련 함수 (0) | 2009.01.31 |
매개변수(parameter)와 인수(argument) (0) | 2009.01.31 |
Comments