Hi...
i am programming Cli/Ser ,so part of the program is to open file to download it from client side,but i want to return the global value Errorno to print it to screen , and how to use strerror() func ???
i write this "This is part of server code" :
Code:
fd= open("abc.txt",O_RDONLY);
//error handilng in open file
if(fd<0)
{
fprintf(stderr,"The Error is : \n");
//bzero(&buffer,sizeof(buffer));
snprintf(buffer,sizeof(buffer),"%d",fd);
n=write(connfd,&buffer,sizeof(buffer));
continue;
}
if the fd <0 return error ,i want to know what is the error and print it to screen
**note :when i use perror() ,the result print to screen like this
"n success"???