473,781 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

binary files

are binary files portable?

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

--
Ian Collins.
Sep 5 '07 #2
<de*********@gm ail.comwrote in message
news:11******** **************@ 22g2000hsm.goog legroups.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*********@gma il.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.n etwrote:
On Tue, 04 Sep 2007 20:55:14 -0700, deepakvs...@gma il.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*********@gma il.com a écrit :
On Sep 5, 12:52 pm, Lionel B <m...@privacy.n etwrote:
>On Tue, 04 Sep 2007 20:55:14 -0700, deepakvs...@gma il.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...@gm ail.com" <deepakvs...@gm ail.com>
wrote:
On Sep 5, 12:52 pm, Lionel B <m...@privacy.n etwrote:
On Tue, 04 Sep 2007 20:55:14 -0700, deepakvs...@gma il.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 objektorientier ter Datenverarbeitu ng
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*********@gma il.com wrote:
On Sep 5, 12:52 pm, Lionel B <m...@privacy.n etwrote:
>On Tue, 04 Sep 2007 20:55:14 -0700, deepakvs...@gma il.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 "portabilit y" 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*********@gm ail.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*********@gm ail.com" <de*********@gm ail.comwrote:
>On Sep 5, 12:52 pm, Lionel B <m...@privacy.n etwrote:
>On Tue, 04 Sep 2007 20:55:14 -0700, deepakvs...@gma il.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
5040
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 any solid reasons to prefer text files over binary files files?
28
2805
by: wwj | last post by:
void main() { char* p="Hello"; printf("%s",p); *p='w'; printf("%s",p); }
9
6520
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 delta binary is pretty huge in size. I have 1 byte file and 2 bytes file, the delta should be 1 byte but somehow it turns out to be 249 bytes using binary formatter. I guess serialization has some other things added to the delta file.
8
5127
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
3665
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 binary mode. according to me, notepad opens files and each byte of the file read, it converts that byte from ascii to its correct character and displays
68
5261
by: vim | last post by:
hello everybody Plz tell the differance between binary file and ascii file............... Thanks in advance vim
3
18961
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 original form. The problem is tha the binary source that I extract from the text file seems to be diferent from the source I saved. Here is my code: 1) handle=file('image.gif','rb')
15
3004
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 successfully created and used txt files. I am trying to save then load in an array of pointers to objects:
3
3849
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 the two problems while trying to read a binary file. 1). All whitespace characters were skipped 2). Certain binary files gave a core dump
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10143
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.