473,325 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Buffered _read and _write... how to get more buffer memory?

Hi,

I'm a newbie C programmer, and I've written a Buffered File Copy
program in C (which can be considered my rather first acceptable
venture into the bold brave world of C)

I am using faralloc() to get large chunks of memory for my buffer and
even that does not work (for buffer size > 65535). But faralloc() does
not show any problem (ie, does not return null) even when I allocate
527 kb of memory)

I'm using _read and _write functions for file i/o and I doubt whether
they are incapable of using more than this amount of data at a time..

I checked out the product 'Controlled Copy' and even it says it uses
only 48kb buffer.. So, is it some barrier which cannot be broken?

I'm relatively new to C programming ('ve been programming in xBase
languages till..). If the source code of my app would help by any
means, then please do contact me and I'll be sending it...

Thanks in advance,

Regards
Jasim A Basheer
India.

please mail me to : ja*******@IHATESPAMMERS.COM -- replace the domain
name with
hotmail.com

-------------------------------------------------------
If there are young guys out here in this group, please get 2 me. I'm
16 and would be glad to have your company too... :))
---------------------------------------------------------
Nov 14 '05 #1
2 3834
[Posted and mailed.]

"Jasim" <ja*****@hotmail.com> wrote in message
news:e1*************************@posting.google.co m...
Hi,

I'm a newbie C programmer, and I've written a Buffered File Copy
program in C (which can be considered my rather first acceptable
venture into the bold brave world of C)

I am using faralloc() to get large chunks of memory for my buffer and
even that does not work (for buffer size > 65535). But faralloc() does
not show any problem (ie, does not return null) even when I allocate
527 kb of memory)
faralloc() is not a standard C function. You must be using some older
compiler (in some weird mode, such as DOS 'small' memory model) that
supports this function as an extension.
I'm using _read and _write functions for file i/o and I doubt whether
they are incapable of using more than this amount of data at a time..
_read() and _write() are not standard C functions either.
I checked out the product 'Controlled Copy' and even it says it uses
only 48kb buffer.. So, is it some barrier which cannot be broken?
We don't know. Since all of the functions that you are asking about are
non-standard, you are unlikely to get an answer here. This newsgroup
discusses standard (also called ANSI or ISO) C only.

Having said that, try checking your documentation for the functions you are
using. Given the weird memory model, it is quite possible that you are using
a 16-bit compiler where ints are not big enough to represent your buffer
size. If _read() and/or _write() take int as a parameter, you are in bad
luck. You need to read/write in smaller blocks.
I'm relatively new to C programming ('ve been programming in xBase
languages till..). If the source code of my app would help by any
means, then please do contact me and I'll be sending it...

Thanks in advance,

Regards
Jasim A Basheer
India.

please mail me to : ja*******@IHATESPAMMERS.COM -- replace the domain
name with
hotmail.com
Two things:
1) The rule in comp.lang.c (and generally on Usenet) is, "post here, read
here". Don't ask for email responses.
2) There's no need to unscramble your address, as your "From:" field
contains a valid address. If you HATESPAMMERS <g>, scramble that one too.
-------------------------------------------------------
If there are young guys out here in this group, please get 2 me. I'm
16 and would be glad to have your company too... :))
---------------------------------------------------------


This is the only reason I am actually replying to you in an email, or indeed
at all. Your post is off topic, which I suppose you would have known if you
had read a few other posts before posting yours. But I admire your youthful
spirit and enthusiasm, so I will let you off this time ;-)

Peter
Nov 14 '05 #2
Dear Mr. Peter,

We don't know. Since all of the functions that you are asking about are
non-standard, you are unlikely to get an answer here. This newsgroup
discusses standard (also called ANSI or ISO) C only. Didnt know. Thanks very much for the tip..

Having said that, try checking your documentation for the functions you are
using. Given the weird memory model, it is quite possible that you are using
a 16-bit compiler where ints are not big enough to represent your buffer
size. If _read() and/or _write() take int as a parameter, you are in bad
luck. You need to read/write in smaller blocks. _read and _write takes long as parameters (in Borland C++ 3.1)
Well, I've figured out a possible solution..
Two things:
1) The rule in comp.lang.c (and generally on Usenet) is, "post here, read
here". Don't ask for email responses. Sorry..
2) There's no need to unscramble your address, as your "From:" field
contains a valid address. If you HATESPAMMERS <g>, scramble that one too. Actually, that is the address I've left for spammers. I dont usually check that
address, (it might be receiving an MB of spam a day..!)
This is the only reason I am actually replying to you in an email, or indeed
at all. Your post is off topic, which I suppose you would have known if you
had read a few other posts before posting yours. But I admire your youthful
spirit and enthusiasm, so I will let you off this time ;-)

Thanks again for your help.. and advice..

Regards,
Jasim
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Steven T. Hatton | last post by:
I haven't looked very closely, but from what I'm seeing, it looks like there are no buffered I/O streams in the Standard Library. There are stream buffers, but not buffered streams. I don't have...
9
by: kernelxu | last post by:
hi,everybody. I calling function setbuf() to change the characteristic of standsrd input buffer. some fragment of the progrem is: (DEV-C++2.9.9.2) #include <stdio.h> #include <stdlib.h> int...
2
by: John | last post by:
I have a file open using fopen and am reaing using fread. Does this mean that the OS (linux) already buffers this file? What is the buffer size? Can I change it? Thanks, --j
3
by: Brad | last post by:
I have a response filter which injects "standard" html into my pages. The filter works fine when the initial stream is small enough not to buffer...or....if I have a large unbuffered stream (i.e. I...
4
by: pank7 | last post by:
hi everyone, I have a program here to test the file IO(actually output) with buffer turned on and off. What I want to see is that there will be obvious differece in time. Here I have an input...
2
by: Karl | last post by:
Hey everyone! I've got a quick question on whether std::ifstream is buffered or not. The reason is that I have a homework assignment that requires me to benchmark copying files using different...
12
by: lh84777 | last post by:
Hello, i'm looking for this behaviour and i write a piece of code which works, but it looks odd to me. can someone help me to refactor it ? i would like to walk across a list of items by...
3
emaghero
by: emaghero | last post by:
Evening all, I have a quick question about the _read function. I am trying to read in a large data set into a character buffer. The data is stored in binary format. The size of the input data file...
8
by: zeeshan708 | last post by:
what is the difference between the buffered and unbuffered stream ??(e.g we say that cout is buffered and cerr is unbuffered stream) does that mean that the output sent to buffered stream have to go...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.