Large 2GB+ file stream

BlitzMax Forums/BlitzMax Programming/Large 2GB+ file stream

Azathoth(Posted 2010) [#1]
This is my first attempt at creating a file stream that exceeds the current 32bit limit.
I haven't tested it much, it does however work writing to a file past the 32bit barrier. You should use the PosEx, SizeEx, and SeekEx to handle the larger 64bit positions and size.

It's Win32 only.




beanage(Posted 2010) [#2]
Couldnt you also use file mapping for this? I use file mapping to manipulate large database files, which is, afaik, what it's intended to be used for [in addition to shared memory].


Azathoth(Posted 2010) [#3]
Actually this is just meant to be an alternative file stream that can read and write files larger than 2GB which the standard module doesn't support.


beanage(Posted 2010) [#4]
Oh I propably behaved a little ignorant, sry, I realy like this solution! It was just a thought, that immidiately came to my mind when I saw your solution.


*(Posted 2010) [#5]
fraggin heck that would be one hell of a level to have a file thats 2Gb :s


Czar Flavius(Posted 2010) [#6]
What can I say, I like my whole world defined to the last blade of grass ;)


Sub_Zero(Posted 2013) [#7]
I've encountered a problem with this 2gb limit...

A couple of questions:

How do I do this in linux?

How do i do file mapping?


Brucey(Posted 2013) [#8]
How do I do this in linux?

Use Wine ? :-)


Sub_Zero(Posted 2013) [#9]
Ah thanks Brucey, but i'm looking for another approach :)


Brucey(Posted 2013) [#10]
Ah! Well, there is a module called BaH.SStream, which could do with some proper testing. It's basically a port of BRL.Stream with large file support.

Type names have an extra "S". So, TSStream instead of TStream.
And of course, most things return Long instead of Int.

It's in SVN.


Sub_Zero(Posted 2013) [#11]
thanks


Sub_Zero(Posted 2013) [#12]
I get this:

Compile error:
Duplicate identifier 'WriteStream' in modules 'brl.stream' and 'bah.sstream'

I tried to comment out "import brl.stream", but to no luck

So i edited sstream.bmx, just changing some of the function names, and then rebuilt the module.
Then building my program gave me this error:

/home/BlitzMax/mod/bah.mod/sstream.mod/sstream.release.linux.x86.a(glue.c.release.linux.x86.o): In function `ftell64_':
glue.c:(.text+0x4b): undefined reference to `ftell64'

So i replaced line 33 of glue.c with:
	*pos = ftello64(stream);


And now it works in linux :)

ps. and it's really fast too :)