my program downloads a 20mb file and then copies it to a file in some other folder.
Now when i copy...i.e when i try to read from this downloaded file
n = read(fd,buff,sizeof(buff));
n is always 1
even though the buffer size is different.
i want my copy to be fast and not 1 byte at a time. WHY IS N = 1 ?
whats going wrong ???
thankx
__________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
On Mon, 22 Mar 2004, Linux User wrote:
Now when i copy...i.e when i try to read from this downloaded file
n = read(fd,buff,sizeof(buff)); n is always 1
where is buff declared? what is it declared as?
do you have code like this:
char buff[1024];
foo(buff);
void foo(char *buff) { n=read(fd, buff, sizeof(buff)); }
Philip
nope!!! my code is like this
void foo(void){
char buff[4096]; ....
n = read(fd,buff,sizeof(buff));
}
the file descriptor "fd" is the same one that was used to download. now all that i am doing is reading from it again to copy. i tried to close fd, and then reopen the file to copy... but it always copies 1 byte at a time. whats happening
--- Philip S Tellis philip.tellis@gmx.net wrote:
On Mon, 22 Mar 2004, Linux User wrote:
Now when i copy...i.e when i try to read from this downloaded file
n = read(fd,buff,sizeof(buff)); n is always 1
where is buff declared? what is it declared as?
do you have code like this:
char buff[1024];
foo(buff);
void foo(char *buff) { n=read(fd, buff, sizeof(buff)); }
Philip
-- Acting is an art which consists of keeping the audience from coughing.
__________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
On Tue, 23 Mar 2004, Linux User wrote:
the file descriptor "fd" is the same one that was used to download. now all that i am doing is reading from it again to
Please don't top post.
Show us what you're doing with the fd.
Philip
what is n declared as ?
--- Linux User metempsychosist@yahoo.com wrote:
nope!!! my code is like this
void foo(void){
char buff[4096]; ....
n = read(fd,buff,sizeof(buff));
}
the file descriptor "fd" is the same one that was used to download. now all that i am doing is reading from it again to copy. i tried to close fd, and then reopen the file to copy... but it always copies 1 byte at a time. whats happening
--- Philip S Tellis philip.tellis@gmx.net wrote:
On Mon, 22 Mar 2004, Linux User wrote:
Now when i copy...i.e when i try to read from this downloaded file
n = read(fd,buff,sizeof(buff)); n is always 1
where is buff declared? what is it declared as?
do you have code like this:
char buff[1024];
foo(buff);
void foo(char *buff) { n=read(fd, buff, sizeof(buff)); }
Philip
-- Acting is an art which consists of keeping the audience from coughing.
--
http://mm.ilug-bom.org.in/mailman/listinfo/linuxers
Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
__________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
i tried declaring n as
1. uint16_t 2. uint32_t 3. int but it still reads 1 byte at a time
its getting frustrating... i dont understand why this is happenening i cant spend time copying a file on byte at a time i have to copy a 100MB file... and larger sizes i hope u understand.
--- Philip S Tellis philip.tellis@gmx.net wrote:
On Tue, 23 Mar 2004, Linux Power wrote:
what is n declared as ?
Why are you wasting bandwidth?
-- The onset and the waning of love make themselves felt in the uneasiness experienced at being alone together. -- Jean de la Bruyere
__________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
On Tue, Mar 23, 2004 at 02:58:20AM -0800, Linux User wrote:
i tried declaring n as
- uint16_t
- uint32_t
- int
but it still reads 1 byte at a time
its getting frustrating... i dont understand why this is happenening i cant spend time copying a file on byte at a time i have to copy a 100MB file... and larger sizes i hope u understand.
Can you post the entire code, instead of just posting a fragment of it?
-Krishna
On Tue, 23 Mar 2004, Linux User spake thusly:
its getting frustrating... i dont understand why this is happenening i cant spend time copying a file on byte at a time i have to copy a 100MB file... and larger sizes i hope u understand.
You may find people more understanding if you follow simple posting rules. Please do not top post. Please dont send entire re to re to re's.
Post the entire relevant part of the code please.