Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > binary files

Reply
Thread Tools

binary files

 
 
deepakvsoni@gmail.com
Guest
Posts: n/a
 
      09-05-2007
are binary files portable?

 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      09-05-2007
wrote:
> are binary files portable?
>

As long as they fit on your USB device....

--
Ian Collins.
 
Reply With Quote
 
 
 
 
Jim Langston
Guest
Posts: n/a
 
      09-05-2007
<> wrote in message
news: 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.


 
Reply With Quote
 
Lionel B
Guest
Posts: n/a
 
      09-05-2007
On Tue, 04 Sep 2007 20:55:14 -0700, wrote:

> are binary files portable?


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

--
Lionel B
 
Reply With Quote
 
deepakvsoni@gmail.com
Guest
Posts: n/a
 
      09-05-2007
On Sep 5, 12:52 pm, Lionel B <m...@privacy.net> wrote:
> 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?

 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      09-05-2007
On Sep 5, 9:55 am, "deepakvs...@gmail.com" <deepakvs...@gmail.com>
wrote:
> On Sep 5, 12:52 pm, Lionel B <m...@privacy.net> wrote:


> > 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:
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

 
Reply With Quote
 
Michael DOUBEZ
Guest
Posts: n/a
 
      09-05-2007
a écrit :
> On Sep 5, 12:52 pm, Lionel B <m...@privacy.net> wrote:
>> 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
 
Reply With Quote
 
Lionel B
Guest
Posts: n/a
 
      09-05-2007
On Wed, 05 Sep 2007 00:55:03 -0700, wrote:

> On Sep 5, 12:52 pm, Lionel B <m...@privacy.net> wrote:
>
>> 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
 
Reply With Quote
 
osmium
Guest
Posts: n/a
 
      09-05-2007
<> wrote:

> 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.


 
Reply With Quote
 
Tim Slattery
Guest
Posts: n/a
 
      09-05-2007
"" <> wrote:

>On Sep 5, 12:52 pm, Lionel B <m...@privacy.net> wrote:
>> 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

http://members.cox.net/slatteryt
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(8-bit binary to two digit bcd) or (8-bit binary to two digit seven segment) Fangs VHDL 3 10-26-2008 06:41 AM
Newbie: working with binary files/extract png from a binary file Jim Ruby 5 02-01-2008 11:21 AM
Advantages of Binary Files over Text files in Search and read utab C++ 3 11-28-2006 03:09 PM
Uploading files with cgi - binary-files are truncated !? dermoon Python 0 10-08-2003 10:21 PM
Re: ostreams, ios::binary, endian, mixed binary-ascii Marc Schellens C++ 8 07-15-2003 12:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57