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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:21:44+00:00 2026-06-03T01:21:44+00:00

ive been reading about this topic and didnt get the specific info for my

  • 0

ive been reading about this topic and didnt get the specific info for my question :

(maybe the following is incorrect – but please do correct me)

Every file( text/binary) is saving BYTES.

byte is 8 bits hence max value is 2^8-1 = 255 codes.

those 255 codes divides to 2 groups:

0..127 : textual chars
128:..255 : special chars.

so binary file contains char codes from the whole range : 0..255 ( ascii chars+special chars).

1 ) correct ?

2) NOw , lets say im saving one INT in binary file. ( 4 byte in 32 bit system)

how does the file tells the progem reads it : its not 4 single unrelated bytes but an int which is 4 bytes ?

  • 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-03T01:21:46+00:00Added an answer on June 3, 2026 at 1:21 am

    so binary file contains char codes from the whole range : 0..255 ( ascii chars+special chars).

    No, a binary file just contains bytes. Values between 0 and 255. They should only be considered as character at all if you decide to ascribe that meaning to them. If it’s a binary file (e.g. a JPEG) then you shouldn’t do that – a byte 65 in image data isn’t logically an ‘A’ – it’s whatever byte 65 means at that point in the file.

    (Note that even text files aren’t divided into “ASCII characters” and “special characters” – it depends on the encoding. In UTF-16, each code unit takes two bytes regardless of its value. In UTF-8 the number of bytes depends on the character you’re trying to represent.)

    how does the file tells the progem reads it : its not 4 single unrelated bytes but an int which is 4 bytes ?

    The file doesn’t tell the program. The program has to know how to read the file. If you ask Notepad to open a JPEG file, it won’t show you an image – it will show you gibberish. Likewise if you try to force an image viewer to open a text file as if it were a JPEG, it will complain that it’s broken.

    Programs reading data need to understand the structure of the data they’re going to read – they have to know what to expect. In some cases the format is quite flexible, like XML: there are well-specified layers, but then the program reads the values with higher-level meaning – elements, attributes etc. In other cases, the format is absolutely precise: first you’ll start with a 4 byte integer, then two 2-byte integers or whatever. It depends on the format.

    EDIT: To answer your specific (repeated) comment:

    Im Cmd shell….youve written your binary file. I have no clue what did you do there. how am i suppose to know whether to read 4 single bytes or 4 bytes as once ?

    Either the program reading the data needs to know the meaning of the data or it doesn’t. If it’s just copying the file from one place to another, it doesn’t need to know the meaning of the data. It doesn’t matter whether it copies it one byte at a time or all four bytes at once.

    If it does need to know the meaning of the data, then just knowing that it’s a four byte integer doesn’t really help much – it would need to know what that integer meant to do anything useful with it. So your file written from the command shell… what does it mean? If I don’t know what it means, what does it matter whether I know to read one byte at a time or four bytes as an integer?

    (As I mentioned above, there’s an intermediate option where code can understand structure without meaning, and expose that structure to other code which then imposes meaning – XML is a classic example of that.)

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

Sidebar

Related Questions

My question is about this topic I've been reading about a bit. Basically my
I've been reading a lot about this problem but I get nothing that suggests
Ive been reading about mysqli multi_query and couldnt find a way to do this
I've been reading a bit about this recently but it looks to be a
i've been reading about this in the docs but couldn't find anything. Do you
I've been reading about this for the last half hour, and here's what I
I've been reading about OOP in C but I never liked how you can't
I've been doing a lot of reading about this subject and I am now
I've been reading about this for a while and I'm not sure I have
I've been reading lots of topics about jQuery and showing div's, but I haven't

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.