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 5939507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:50:17+00:00 2026-05-22T15:50:17+00:00

I am curious as to how applications generate their own data that is used

  • 0

I am curious as to how applications generate their own data that is used with the application itself. For example, if you take any kind of PC game’s save file or some sort of program that generates binary data like Photoshop’s PSD files or .torrent files for BitTorrent applications, I’d assume they are all specific to the corresponding application and that the authors of that application programmed the way this data was created. My first question is: is that true? I am 99% positive that it is binary data because when opening a PSD file or a .torrent file in Notepad++, it’s easy to see that it’s nothing that can be read by a human…

My second question is: if I wanted to make an application that generates its own data in binary format (no plain-text or anything that’s easily manipulated), how would I go about handling this data? I can vaguely picture generating this data and saving it to a file in binary format, but I am really stuck on how I’d handle this data when it’s needed by the application again. Since this type of data is not plain text and can’t be treated as a string or anything like that, how is it that applications create and handle/parse their own binary data (or any binary data in general)?

I can obviously see that when you open a PSD file, Photoshop opens and it displays whatever the PSD file contained. But how do many applications handle these formats? I am just not seeing how to parse this specific data (or binary data in general) and programmatically do what you want to with it.

  • 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-22T15:50:18+00:00Added an answer on May 22, 2026 at 3:50 pm

    Well, as a simple example, let’s take bitmaps.

    Bitmaps have a standard file structure, which is defined by the info header and file header.

    On the wikipedia article (link: http://en.wikipedia.org/wiki/BMP_file_format) you’ll see that the info header has a well defined format, as well as the file header.

    Each of these is written as binary as is, and is read in as binary as is. Then, the actually bitmap image is written out as binary.

    In other applications, the application may choose to do a custom plain text format, in which case it must be written to in a consistent manner or have some support for versioning so you can use newer features in the file.

    Look up on serialization though, it’s a rather broad topic and there are lots of approaches to this.

    Edit: Here is a code sample (not optimal) for reading (or writing, with the right modifications) in bitmaps:

    // Tell visual studio to align on 2-byte boundary
    // Necessary so if you write to file, it only writes 14 bytes and not 16.
    #pragma pack(2)
    struct BMIH
    {
        short bfType;
        long bfSize;
        short bfReserved0;
        short bfReserved1;
        long bOffbits;
    };
    
    #pragma pack(8)
    struct BMFH
    {
        long biSize;
        long biWidth;
        long biHeight;
        short biPlanes;
        short biBitCount;
        long biCompression;
        long biImageSize;
        long biXPelsPerMeter;
        long biYPelsPerMeter;
        long biClrUsed;
        long biClrImportant;
    };
    
    
    
    BMIH infoheader;
    BMFH fileheader;
    
    std::fstream file(filename.c_str(), std::ios::in | std::ios::binary);
    
    // Read in info and file headers
    file.read((char *) &infoheader, sizeof(infoheader));
    file.read((char *) &fileheader, sizeof(fileheader));
    
        // Calculate size of image
    int size = fileheader.biHeight * fileheader.biWidth;
    int bytes = size * fileheader.biBitCount / 8;
    
        // Read in the image to a buffer
    unsigned char data = new unsigned char[bytes];
    file.read((char *) td.data, bytes);
        file.close();
    

    That code is actually a drastic simplification and completely ignores all sorts of issues, such as what happens if the file headers or data are corrupt, if the file isn’t incomplete, etc. But it’s just meant as a proof of concept. The #pragmas are actually visual studio specific for enforcing proper alignment of the headers.

    When we write this out to a file, we might not actually say “Okay, now write out this integer”. Instead, we want to write it as a binary format. For example, code that you might (but shouldn’t) use to write it would look like:

    // Assume for arguments sake these data structures came pre-filled
    BMFH fileheader;
    BMIH infoheader;
    unsigned char *data; 
    int size = fileheader.biHeight * fileheader.biWidth;
    int bytes = size * fileheader.biBitCount / 8;
    
    std::fstream file("MyImage.bitmap", std::ios::out | std::ios::binary);
    
    file.write((char *) &infoheader, sizeof(BMIH));
    file.write((char *) &fileheader, sizeof(BMFH));
    file.write((char *) data, sizeof(unsigned char) * bytes);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm curious as to the exact conditions that cause an application to be Just
I am writing a web application that requires user interaction via email. I'm curious
I've written a VB.NET application that uses SQL CE 3.5. I'm curious if anyone
I'm curious to find out how people manage their packages in their applications. For
I know that C# applications will require the .Net framework to execute on any
I have an ASP.NET application that relies on the Random class to generate a
Im curious if their is a way to make a windows application ( in
I was curious as to what other shops are doing regarding base application frameworks?
I'm curious, how do you integrate a webcam with an ASP.NET C# application in
Although I'm specifically interested in web application information, I would also be somewhat curious

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.