BeginToLearn
asked on
mystery
hi all,
My standalone compress/decompress works perfect. After i imported compress function to my code, it work perfect. However, after import decompress function, it can't decompress the file. As a result, the file is empty. . After i check, it seems gzread() can't read. but the code is just copy and paste. Please tell me what i did wrong. tks a lot.
+ please remove .c in test1a.txt.myziphaha as the input
+ sample.c is the standalone
+ server.c at line 222 is to call decompress.
test1a.txt.myziphaha.c
sample.c
server.c
My standalone compress/decompress works perfect. After i imported compress function to my code, it work perfect. However, after import decompress function, it can't decompress the file. As a result, the file is empty. . After i check, it seems gzread() can't read. but the code is just copy and paste. Please tell me what i did wrong. tks a lot.
+ please remove .c in test1a.txt.myziphaha as the input
+ sample.c is the standalone
+ server.c at line 222 is to call decompress.
test1a.txt.myziphaha.c
sample.c
server.c
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hmm... weird.
Do you link the same libraries?
And fred(buffer) above should obviously have been free(buffer).
Kent
ASKER
verything is same.i cppy n pastr from sample.c .you can take a lok at sample.c .tks a lot.very weird
ASKER
your suggestion doesn't work. Somehow gzread() always return 0 . but in sample.c, it can return proper value.
ASKER
ubuntu@ubuntu:~/program$ ./server /home/ubuntu/program/dest1 51000
constructor, dirname: /home/ubuntu/program/dest1
message1-> total number of files is 1
filename:test1a.txt.myziph aha
input:/home/ubuntu/program /dest1/tes t1a.txt.my ziphaha
output:/home/ubuntu/progra m/dest1/te st1a.txt
outside while, num_read:0
ubuntu@ubuntu:~/program$
--> so it can't get in the read/write loop
constructor, dirname: /home/ubuntu/program/dest1
message1-> total number of files is 1
filename:test1a.txt.myziph
input:/home/ubuntu/program
output:/home/ubuntu/progra
outside while, num_read:0
ubuntu@ubuntu:~/program$
--> so it can't get in the read/write loop
ASKER
I have tried all ways, but fail. if I just run sample to decompress it, it works. do you see anything wrong?
ASKER
I solved it :) reason is I call decompress before fclose() hihi
ASKER