Hi,
this is a very basic question, but i haven't been able to find anything useful on the net so far. so i have my program that reads from file in two ways:
./prog -i input
or
./prog < input
i am running this under unix
and the way i am readin it is like this:
Code:
int fd;
if(args->i != NULL){
fd = open(args->i,0);
}else{
fd = 0;
}
if(fd < 0){
printf("ERROR could not open input file %s\n",args->i);
return -1;
}
while((c = read(fd,buf,BUFSIZ)) > 0){
...
}
so i can check if my -i is defined or not , but how do i check that for my redirect?
thank you
baxy