x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I tell FileManager to accept both Read and Write?

Hello,

I am writing a file structure for our game we are making. I have ran into an issue with FileManager's CreateFileReader and the issue is the file structure I have needs both support for read/write methods. Only issue that I am having is that I am getting a InPos <= Size error that is called in Seek the check call, which is causing problems.

Let me explain what I have so far:

I am creating a Data Object Database structure that acts much like a book. Each "Page" which is an Index Block, contains 50 "Data Blocks" per "Index Block" up to 50 before it makes another page.

When I am creating the database for the first time, I have no problem when it comes to seeking bytes for example.

Header is 100 bytes, regardless of what is written it reserves 100 bytes always.

That means perhaps only 58 bytes are written but when I seek to 100 it will push the buffer to that position, which is intentional. When I then write the first Page which is empty and contains no data blocks.

When I go and write a data block I get a big issue because each Index Block and Data Block contains a MAXIMUM of 4096 bytes in size. Once the database is created it will then Open the stream for reading purposes after closing it aka when creating an empty database for the first time.

I read the header which seeks at 0, and then the index page 0 which is offset at 100 bytes to read the first 'page'. Now as expected the database loads fine. As soon as I go to write a datablock it offsets based on this amount.

Remember that the CreateFileReader is now the FArchive purpose using GenericReader

HEADER_SIZE + (blockId BLOCK_SIZE) + (IndexBlockHeaderSize + (IndexesPerBlock IndexBlockSizePerEntry));

100 + (0) + (46 + (50 * 81)) = 4196 to Seek for.

InPos = 4196 Size = 188 bytes check(InPos <= Size)

Crash.....

Therefore now what can I do to make this work correctly? Would I need to create my own FArchive to where it supports both "Read" and "Write" along with Seek?

Product Version: UE 4.8
Tags:
more ▼

asked Aug 15 '15 at 12:18 AM in C++ Programming

avatar image

Ravenal
18 4 5 11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question