Writing Garbage data to file ???
Im programming client/server app that client provide the file name then the server send it to client then the client will save it ..
this is part of code in client
So i have 2 problems ::
printf("FIle is being downloaded ...\n");
fd=open("NewFile.txt",O_WRONLY |O_CREAT| O_APPEND);
1st one is when i write to file the file permission i cant define it with data type mode_t ,so the file does not open at all after creation...
2nd one is: the data in buffer is less than 1024 ,the data wrote to buffer but with garbage data . How to make the file read only the real data with garbage ????