ftp application using socket programming

i have made a ftp application in socket programming which uses TCP/IP .. i have the problem runing the only problem is on the client side i take the user input for the file to be downloaded from the command promt.

write(s, argv[2], strlen(argv[2])+1); // this is how i write in client side
argv[2] is reading the file name
read(sa, buf, BUF_SIZE);// how i read in server side
sa is the variable for newsockfd
the only from problem is if the user requests for a file which does not exist .. how to put a error condition for it and how to chck it..

i

You can just try to open the file in any case. Suppose you are using the open system call, then opening a file that does not exist will return -1 and the errno variable will be set with "ENOENT". When this happens, you can return an error to the client saying that the file does not exist.