Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Slow file reading/writting in open to read/write case. Is it possible to load/write entire file into/from memblock?

Author
Message
Leonid
User Banned
Posted: 19th Jun 2012 01:40
Slow file reading/writting in open to read/write case. Is it possible to load/write entire file into/from memblock (not in byte-to-byte mode)? File of memblock (if to see it into a text editor) contains first 4 bytes to set size of memblock and last byte to mark EndOfFile. Is it possible to make file of memblock without these 5 ugly bytes? Example. My program is reading excel table as txt file. If I use open to read/write command, it works too slowly. If I use read memblock from file, I has a problem with first 4 bytes and last 1 byte - file reading is wrong.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Jun 2012 16:08
I think you are using the READ MEMBLOCK/WRITE MEMBLOCK commands. Instead, use the MAKE MEMBLOCK FROM FILE/MAKE FILE FROM MEMBLOCK commands.

... or is it the other way around? I can't remember.

Leonid
User Banned
Posted: 21st Jun 2012 09:32 Edited at: 21st Jun 2012 09:32
If I am will making a file from memblock, any way I will must save/load it byte-to-byte using READ BYTE and WRITE BYTE. There is no command like SAVE FILE (entire) and LOAD FILE (entire).
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 21st Jun 2012 12:44
Quote: "There is no command like SAVE FILE (entire) and LOAD FILE (entire)."


- Write memblock fileno, memno
- read memblock fileno, memno

- make file from memblock fileno, memno
- make memblock from file fileno, memno

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Jun 2012 23:15
Ok, confusion over (mine).

It's the MAKE commands that allow you to read/write memblocks with whole files:


Quote: "If I am will making a file from memblock..."

Nope, use this example with a text file of your own.

Login to post a reply

Server time is: 2026-07-07 23:01:13
Your offset time is: 2026-07-07 23:01:13