Hi...
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
Code:
char buffer[1024];
printf("FIle is being downloaded ...\n");
printf("%s\n",buffer);
int fd;
fd=open("NewFile.txt",O_WRONLY |O_CREAT| O_APPEND);
write(fd,buffer,sizeof(buffer));
So i have 2 problems ::
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 ????
Thanks,