저수준 입출력 숙제
2010. 5. 11. 21:24ㆍ2010년/시스템제어
#include<stdio.h>
#include<fcntl.h>
#include<sys\types.h>
#include<sys\stat.h>
int main()
{
int fd;
int bytes;
int i;
char buf[512];
if((fd=open("main.in",O_RDONLY|O_BINARY))<0)
{
printf("main.in을 열수없습니다 \n");
return 0;
}
while((bytes=read(fd,buf,512))>0)
{
for(i=0;i<bytes;i++)
{
printf("%x",buf[i]);
if(i%2==1)
{
printf("\t");
}
}
}
close(fd);
return 0;
}
'2010년 > 시스템제어' 카테고리의 다른 글
2010년 3월2일 (0) | 2010.03.02 |
---|