Originally Posted by
master5001
As I mentioned, I didn't think that was the issue, I am just issuing you a warning in more human terms than your compiler issues warnings in. Because you will listen to us where your compiler fails to get through to you. And yeah your closes are all out of whack. And more importantly, your code doesn't look like it uses any of the C stream functionality at all... well except for fclose()........
I'm taking this to heart because I obviously want your advice. What do you mean by "your code doesn't look like it uses any of the C stream functionality at all":
Code:
FILE *fstRO = fopen(argv[1], "rb"), * sstOUT;
FILE *fstW = fopen("/root/test/image.jpg", "wb");
struct sockaddr addr;
if (fstRO == NULL) {
puts("valid filename required");
return -1;}
stat(argv[1],&finfo);
bytes=finfo.st_size;
buffer=malloc(bytes);
buffer2=malloc(bytes);
printf("%d\n",bytes);
fread(buffer,bytes,1,fstRO);
fclose(fstRO);
Is all the C stream functionality I could muster, except for the final buffer write and
Code:
if ((sstOUT=fdopen(OUT,"w"))==NULL) perror("fdopen");
which is just there to demonstrate that it doesn't work.
And what, pray tell, are my closes "out of whack" with?
ps. I didn't use fwrite because -- once again -- fdopen (there is only one) FAILED. The write is to the socket descriptor, not a stream.
pps. I just noticed that cboard will not accept "* sst" without the space, and instead replaced it with ........ perhaps I am haunted today.