473,326 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

binary files

are binary files portable?

Sep 5 '07 #1
9 2850
de*********@gmail.com wrote:
are binary files portable?
As long as they fit on your USB device....

--
Ian Collins.
Sep 5 '07 #2
<de*********@gmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
are binary files portable?
On the presumption you mean binaray data files, it depends on your
definition of "portable". There may be some issues with things such as
endian if the data is written on a system with, say, big endian and tried to
be read from a system with little endiant and the program does not that that
into account. But, consider, binary data files such as .jpg can be
displayed on both windows and linux systems as well as macs, etc... But, an
os specific program is needed to read the data and display it appropriately.
Sep 5 '07 #3
On Tue, 04 Sep 2007 20:55:14 -0700, de*********@gmail.com wrote:
are binary files portable?
I hope so - aren't all computer files binary?

--
Lionel B
Sep 5 '07 #4
On Sep 5, 12:52 pm, Lionel B <m...@privacy.netwrote:
On Tue, 04 Sep 2007 20:55:14 -0700, deepakvs...@gmail.com wrote:
are binary files portable?

I hope so - aren't all computer files binary?

--
Lionel B
what about binary files created in c++?? are they portable?

Sep 5 '07 #5
de*********@gmail.com a écrit :
On Sep 5, 12:52 pm, Lionel B <m...@privacy.netwrote:
>On Tue, 04 Sep 2007 20:55:14 -0700, deepakvs...@gmail.com wrote:
>>are binary files portable?
I hope so - aren't all computer files binary?

what about binary files created in c++?? are they portable?
That depends on how you create them. Google for "serialization".

Michael
Sep 5 '07 #6
On Sep 5, 9:55 am, "deepakvs...@gmail.com" <deepakvs...@gmail.com>
wrote:
On Sep 5, 12:52 pm, Lionel B <m...@privacy.netwrote:
On Tue, 04 Sep 2007 20:55:14 -0700, deepakvs...@gmail.com wrote:
are binary files portable?
I hope so - aren't all computer files binary?
what about binary files created in c++?? are they portable?
Whether a file is "portable" or not is independant of whether it
is text or binary. A file is portable to all systems which
understand its format.

Typically, of course, binary files are more portable than text
files, because computer programmers seem to be more aware of the
portability problems involving binary files. But anyone who has
opened a file written under Unix with Notepad knows that text
files aren't very portable. Not to mention when you start
having to deal with different encodings. And of course, if the
target program expects HTML, and you've output LaTeX, there's
going to be a portability problem as well.

C++ itself doesn't make any assumtions about file format. Text
or binary, it's up to the creating program to format. About the
only difference is that C++ does provide formatting and parsing
for the built-in types (e.g. int, double) for a number of
typical text formats, but no formatting or parsing for binary
formats. The historical reason for this is probably that Unix
(where C and C++ grew up) only uses binary formats for a very
few machine dependent files: object files or executables, for
example, which by their very nature aren't portable.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Sep 5 '07 #7
On Wed, 05 Sep 2007 00:55:03 -0700, de*********@gmail.com wrote:
On Sep 5, 12:52 pm, Lionel B <m...@privacy.netwrote:
>On Tue, 04 Sep 2007 20:55:14 -0700, deepakvs...@gmail.com wrote:
>>are binary files portable?

I hope so - aren't all computer files binary?

what about binary files created in c++?? are they portable?
I was being kind of facetious... but not quite. I assume you meant
"binary" as opposed to "text". But computer files really are just 0s and
1s - how one chooses to interpret the 0s and 1s depends on conventions
between the producer and consumer of the data in question. After all, how
portable are "text files"? There are many different conventions (perhaps
read "encodings") for text, of varying degrees of "portability" in the
computer world.

So to answer your question: a "binary" (i.e. *any*) file, whether it be
created in C++ or whatever, is only "portable" insofar as the person/
machine that is going to have to interpret the data it contains knows how
to do so.

--
Lionel B
Sep 5 '07 #8
<de*********@gmail.comwrote:
are binary files portable?
Step 1. Define what binary means.
Step 2. Define what portable means.
Step 3. Post a new question, if you still have one.
Sep 5 '07 #9
"de*********@gmail.com" <de*********@gmail.comwrote:
>On Sep 5, 12:52 pm, Lionel B <m...@privacy.netwrote:
>On Tue, 04 Sep 2007 20:55:14 -0700, deepakvs...@gmail.com wrote:
are binary files portable?

I hope so - aren't all computer files binary?

--
Lionel B

what about binary files created in c++?? are they portable?
What do mean by a binary file? Executables created by compiling a C++
program should be portable to another machine running the same or
compatible OS and hardware. You couldn't compile a program on Windows
and run it on a Mac (unless you used a cross-compiler).

Other than that, there are still things to watch out for. Different
hardware and OSs may have different internal representations for
floating point numbers or integers (especially big-little endian
differences). That could make it impossible - or at least quite
difficult - to read a binary file created on a different machine that
the one it was created on.

--
Tim Slattery
Sl********@bls.gov
http://members.cox.net/slatteryt
Sep 5 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Eric | last post by:
Assume that disk space is not an issue (the files will be small < 5k in general for the purpose of storing preferences) Assume that transportation to another OS may never occur. Are there...
28
by: wwj | last post by:
void main() { char* p="Hello"; printf("%s",p); *p='w'; printf("%s",p); }
9
by: Ching-Lung | last post by:
Hi all, I try to create a tool to check the delta (diff) of 2 binaries and create the delta binary. I use binary formatter (serialization) to create the delta binary. It works fine but the...
8
by: dagecko | last post by:
Hi I would like to know how to detect if a file is binary or not. It's important for me but I don't know where to start. Ty
10
by: joelagnel | last post by:
hi friends, i've been having this confusion for about a year, i want to know the exact difference between text and binary files. using the fwrite function in c, i wrote 2 bytes of integers in...
68
by: vim | last post by:
hello everybody Plz tell the differance between binary file and ascii file............... Thanks in advance vim
3
by: nicolasg | last post by:
Hi, I'm trying to open a file (any file) in binary mode and save it inside a new text file. After that I want to read the source from the text file and save it back to the disk with its...
15
by: JoeC | last post by:
I am writing a program that I am trying to learn and save binary files. This is the page I found as a source: http://www.angelfire.com/country/aldev0/cpphowto/cpp_BinaryFileIO.html I have...
3
by: masood.iqbal | last post by:
Hi, Kindly excuse my novice question. In all the literature on ifstream that I have seen, nowhere have I read what happens if you try to read a binary file using the ">>" operator. I ran into...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.