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

  • SEARCH
  • Home
  • 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 8707993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:00:24+00:00 2026-06-13T04:00:24+00:00

im creating a dll in MS Visual Studio 2010 Express which loads a binary

  • 0

im creating a dll in MS Visual Studio 2010 Express which loads a binary data file (*.mgr extension -> used exclusively in my company’s applications) using fstream library in C++. The file is created with an app developed by someone else in my company who is using Delphi. He says the first 15 bytes should be some characters which indicate the date the file was created and some other stuff like version of the app:

“XXXX 2012”.

The result after loading with fstream (in binary mode) and writing another file with fstream (string mode) is as follows:

“[] X X X X 2 0 1 2”

The first char is an unknown char (rectangle) then there are spaces between each char. Finally it is 31 bytes wide. 15 for actual chars + 15 for white spaces + 1 for the rect char = 31.

Some other information:
I’m using C++, the app developer is using Delphi.
Im using fstream. he is using BW.Write() function. (BW == Binary Writer?)
He uses Windows 7 whilst i use Windows XP Professional.

Can you make a diagnosis of the problem?

Thanks in advance

First Edit: I’m adding c++ code that loads those first bytes.

Firstly he is using Delphi XE2 from embarcadero Rad Studio XE2.

From what i know PChar is a null-terminated string consisting of widechars (since delphi 2009) which are 2 bytes wide as opposed to normal chars (one byte). So basically he’s saving words instead of bytes.

here is the code loading the mgr:

wchar_t header[15];
DXFLIBRARY_API void loadMGR(const char* szFileName, const char* szOutput)
{
fstream file;
file.open( szFileName, ios::binary | ios::in );
if(file.is_open()) 
{
    file.read(reinterpret_cast<char*>(header),sizeof(header));
}
file.close();

//zapis

fstream saveFile;
saveFile.open( szOutput, ios::out );
if(saveFile.is_open())
{
    saveFile.write(reinterpret_cast<const char*>(header),sizeof(header));
}
saveFile.close(); 
}

Header contains 15 wchar_t’s so we get 30 bytes. Still after investigating i have no idea how to convert.

  • 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-06-13T04:00:26+00:00Added an answer on June 13, 2026 at 4:00 am

    It seems pretty clear that somewhere along the way the data is being mangled between an 8 bit text encoding and a 16 bit encoding. The spurious first character is almost certainly the UTF-16 BOM.

    One possible explanation is that the Delphi developer is writing UTF-16 encoding text to the file. And presumably you are expecting an 8 bit encoding.

    Another explanation is that the Delphi code is correctly writing out 8 bit text, but that your code is mangling it. Perhaps your read/write code is doing that.

    Use a hex editor on the file output from the Delphi program to narrow down exactly where the mangling occurs.

    In the absence of any code in the question, it’s hard to be more specific than this.

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

Sidebar

Related Questions

Is there a way to generate a DLL file from Visual Studio Express without
Im creating an unmanaged DLL in Visual Studio 2010. In order to test my
I am creating a simple C++ DLL project using Visual Studio 2008 Express Edition.
I'm creating an application in C# using Visual Studio 2010/.NET 4.0. For part of
i installed visual studio 2010 ultimate version and tfs2010 when i wana creating custom
I have a Visual Studio 2008 C++ project where I'm creating a DLL with
I am having trouble creating a new edmx file using Visual Studio 2011 beta
I am creating a test project in Visual Studio 2010 for my existing project.
Visual Studio C++ 2005 Windows XP I am creating this DLL library. The DLL
I have tried creating several web parts using Visual Studio 2010 using available guides

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.