SIMULATION OF UNIX COMMANDS
Programs
// 2. cat command
#include<fcntl.h>
#include<sys/stat.h>
#define BUFSIZE 1
int main(int argc, char **argv)
{
int fd1;
int n;
char buf;
fd1=open(argv[1],O_RDONLY);
while((n=read(fd1,&buf,1))>0)
printf("%c",buf);
return (0);
}
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu