Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7079581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:41:22+00:00 2026-05-28T06:41:22+00:00

I am trying to read in with C# a file written with CArchive. From

  • 0

I am trying to read in with C# a file written with CArchive. From what I can tell the format is:

[length of next set of data][data]…etc

I’m still fuzzy on some of the data, though. How do I read in Date data? What about floats, ints, doubles, etc?

Also, [length of next set of data] could be a byte or word or dword. How do I know when it will be each? For instance, for a string “1.10” the data is:

04 31 2e 31 30

The 04 is the length, obviously and the rest are hex values for 1.10. Trivial. Later I have a string that is 41 characters long, but the [length] value is:

00 00 00 29

Why 4 bytes for the length? (0x29 = 41)

The main question is: Is there a spec for the format of CArchive output?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:41:23+00:00Added an answer on May 28, 2026 at 6:41 am

    To answer your question about strings, the length value that is stored in the archive is itself variable-length depending on the length and encoding of its string. If the string is < 255 characters, one byte is used for the length. If the string is 255 - 65534 characters, 3 bytes are used – a 1-byte 0xFF marker followed by a 2-byte word. If the string is 65535+ characters, 7 bytes are used – a 3-byte 0xFF 0xFF 0xFF marker followed by a 4-byte dword. To make it even more complicated, if the string is Unicode encoded, the length value is preceeded by a 3-byte 0xFF 0xFFFE marker. So in any, combination, you will never see a 4-byte length by itself, so what you showed has to be 3 0x00 bytes belonging to something else, followed by a 1-byte string length 0x29.

    So, the correct way to read a string is as follows:

    Assume: string data is Ansi unless told otherwise.

    1. Read a byte. If its value is < 255, string length is the value, goto 3.

    2. Read a word. If its value is 0xFFFE, string data is Unicode, goto 1. Otherwise, if its value is < 65535, string length is its value, goto 3. Otherwise, read a dword, string length is its value, goto 3.

    3. read string length number of 8bit or 16bit values, depending on whether string is Ansi or Unicode, and then convert to desired encoding as needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to read from file: The file is multiline and basically i
I'm trying to read a file from a local filesystem. I do not have
I am trying to read a file line-by-line, and storing that line of data
I am trying to read this file I created as sample made up from
I'm trying to read xml file from vbs script. Xml is encoded in utf-8
i'm trying to read contents of PNG file. As you may know, all data
I have created new class to read the data from xml file, which looks
I am trying to read a binary file written by an legacy Fortan application.
I'm trying to read an object from a XML file using XMLDecoder. The construction
I'm trying to use java to read a string from a file that was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.