Simple Borland C++ Help

Thread Starter

Art

Joined Sep 10, 2007
806
Hi Guys,
I'm new to Windows programming and a friend gave me a (legit) copy of Borland C++ to use temporarily.
I have only a few samples, limited help, and have achieved a few small things.

What I'd like help with is a small routine to load a file into a u8 array,
and saved back to file again with the correct file size.

I know that the file opened will be no more than 10 Mb, so the array can be say
u8 filearray[109999];

and never overflow as long as the correct file type filter was used.

Any help would be much appreciated.
Art.
 
Hey Art,

There are plenty of built in functions what will accomplish all you I/O tasks in the Standard C and/or C++ library.

More information would be good.
Like how you file is structured. Has it got each record on a new-line, tab delimited, comma delimited, certain amount of bytes per record?? etc...

Are you using BCB5/5.5 or the builder, or BDS?

cheers,
 

Thread Starter

Art

Joined Sep 10, 2007
806
It's C++ Builder V5

Doesn't matter how the file is structured. Let's say it's structureless,
like for example, the file is known to be 10Mb consisting purely of bytes that are all
0x41 value.

Say I want to read the whole 10Mb into the array, change the tenth byte of the array
to 0x00, and save the file again from the array where the byte was changed.
 

Thread Starter

Art

Joined Sep 10, 2007
806
Well I figured it out by sort of doing the reverse of the routine I had to open & write to a file :)
 
Last edited:
Top