473,902 Members | 5,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

differance between binary file and ascii file

vim
hello everybody
Plz tell the differance between binary file and ascii
file........... ....
Thanks
in advance
vim

May 13 '06
68 5297
osmium wrote:
But wasn't the word byte pretty much introduced into the world by the IBM
360 in 1964 or thereabouts?


No. The word "byte" was common long before 1964, and with many machines
when no one had ever hallucinated a 360. In fact, it is from 1956,
coined by Werner Buchholz.
At least you got the company right. Otherwise, you have wrong
the date: 1956, not 1964
the computer: IBM Stretch, not IBM 360
You probably got the size wrong, too. Its orginal incarnation was 1 to
6 bits, not 8. The Dec family, especially the PDP-6 and -10 nicely
extended this to 1 to 36 bits.
May 14 '06 #31
"Tomás" <NU**@NULL.NULL > writes:
Chris Hills posted:
Unfortunately both are wrong... A byte AFAIK is the smallest amount you
can address on a MCU/CPU. Now 95% of the time it is 8 bits but in the
past it has been many other things.


Incorrect.

On a particular system, it's okay if:

A) The smallest amount of memory addressable is 16 bits.
B) A char is 8 bits. (And thus a byte is 8 bits).

To facilitate this on this particular system, a char* holds more info than
an int*, because it also specifies whether it wants "the first 8 bits or
the last 8 bits".


Then an 8-bit byte is addressible (with a little extra effort by the
compiler).

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
May 14 '06 #32
Chris Hills <ch***@phaedsys .org> writes:
In article <44************ ***********@new s.optusnet.com. au>, Alan
<i.****@octopus .com.au> writes

[...]
This newsgroup is for C language related questions. The OP is asking a more
generalized question.


We keep having this argument. SOME users want to limit the scope of this
NG and other want to widen it. As there is no charter the majority will
eventually prevail.


There is currently exactly one newsgroup where we can discuss standard
C without getting bogged down in system-specific or otherwise
irrelevant details. (comp.lang.c.mo derated is too slow, and
comp.std.c has a different purpose.) Some users want us to have *no*
such newsgroup at all. It's possible that they'll eventually prevail,
but I sincerely hope they don't.

Chris, I've asked you a couple of questions on this topic, and you've
never answered them.

You mentioned other (non-Usenet) forums where people discuss the C
programming language. I'd like to take a look. Where are they?

If you think the current topicality guidelines should be changed,
*how* do you think they should be changed? Can you give specific
examples of things you think should be considered topical that
currently aren't? If there were a charter for this newsgroup, what
should it say?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
May 14 '06 #33
"osmium" <r1********@com cast.net> writes:
[...]
I'll be damned! In Note 2, they defined byte very precisely as a word that
simply means a collection of contiguous bits. They took a widely used
word, that meant something to hundreds of thousands of people and redefined
it to mean something entirely different.

There are about 30 definitions of byte that make the cut on google, and the
*vast* majority say a byte is eight bits.

http://tinyurl.com/j79j4

That's simply appalling! Now the world needs a committee to define a word
for eight contiguous bits. How about naming it in honor of the clown who
got that inserted into the standard?

Historically, the smallest addressable unit of storage was a character.
They seem to have gotten tangled up and ignored the distinction between a
character and a character code, and ignored the fact hat they were different
things. I think this made up example from history is right: The IBM 7094
has a six-bit character. The character code is BCD.


No, the term "byte" did not originally mean exactly 8 bits.

<http://www.catb.org/~esr/jargon/html/B/byte.html> says:

byte: /bi:t/, n.

[techspeak] A unit of memory or data equal to the amount used to
represent one character; on modern architectures this is
invariably 8 bits. Some older architectures used byte for
quantities of 6, 7, or (especially) 9 bits, and the PDP-10
supported bytes that were actually bitfields of 1 to 36 bits!
These usages are now obsolete, killed off by universal adoption of
power-of-2 word sizes.

Historical note: The term was coined by Werner Buchholz in 1956
during the early design phase for the IBM Stretch computer;
originally it was described as 1 to 6 bits (typical I/O equipment
of the period used 6-bit chunks of information). The move to an
8-bit byte happened in late 1956, and this size was later adopted
and promulgated as a standard by the System/360. The word was
coined by mutating the word .bite. so it would not be accidentally
misspelled as bit. See also nybble.

(I would dispute the use of the word "invariably ".)

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
May 14 '06 #34
In article <ln************ @nuthaus.mib.or g>, Keith Thompson <kst-
u@mib.org> writes
Chris Hills <ch***@phaedsys .org> writes:
In article <44************ ***********@new s.optusnet.com. au>, Alan
<i.****@octopus .com.au> writes[...]
This newsgroup is for C language related questions. The OP is asking a more
generalize d question.


We keep having this argument. SOME users want to limit the scope of this
NG and other want to widen it. As there is no charter the majority will
eventually prevail.


There is currently exactly one newsgroup where we can discuss standard
C without getting bogged down in system-specific or otherwise
irrelevant details. (comp.lang.c.mo derated is too slow, and
comp.std.c has a different purpose.) Some users want us to have *no*
such newsgroup at all. It's possible that they'll eventually prevail,
but I sincerely hope they don't.

Chris, I've asked you a couple of questions on this topic, and you've
never answered them.


I have them marked for reply and feeling guilty I have not done so. It
needs thinking about for specific answers and I have been busy this week
and did not want to just dash off a quick reply.
You mentioned other (non-Usenet) forums where people discuss the C
programming language. I'd like to take a look. Where are they?
I found some on both Yahoo and Google. The problem is it is very easy on
Yahoo to start a group compared to usenet. SO some people never get past
the web interface of Yahoo and to the usenet groups.

It came as quite a surprise to me that there were so many c, c++ 8051
and 8 bit MCU Yahoo groups. People how have no idea that there is a
comp.arch.embed ded. Eventually the people using some of the usenet the
technical groups are going to fade away and not be replaced.
If you think the current topicality guidelines should be changed,
*how* do you think they should be changed? Can you give specific
examples of things you think should be considered topical that
currently aren't? If there were a charter for this newsgroup, what
should it say?


That is a good idea.... can we draw up a charter? It would mean people
have to think about it. I did not replay to your "specific" question as
it needed some thought and I did not want to do an off the cuff reply.

The problem is it is difficult to be specific on vaguely loosening a
tight spec. :-)


--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

May 14 '06 #35
"Chris Hills" wrote:
Keith Thompson wrote:

If you think the current topicality guidelines should be changed,
*how* do you think they should be changed? Can you give specific
examples of things you think should be considered topical that
currently aren't? If there were a charter for this newsgroup, what
should it say?


That is a good idea.... can we draw up a charter? It would mean people
have to think about it. I did not replay to your "specific" question as
it needed some thought and I did not want to do an off the cuff reply.


<I *think* that pruning is right>

My guess is that the question is more along the lines of "If I gave you a
million dollars, what would you do with it?".
May 14 '06 #36
"osmium" <r1********@com cast.net> wrote in message
news:4c******** *****@individua l.net...
"P.J. Plauger" writes:
I'll be damned! In Note 2, they defined byte very precisely as a word
that simply means a collection of contiguous bits. They took a widely
used word, that meant something to hundreds of thousands of people and
redefined it to mean something entirely different.

There are about 30 definitions of byte that make the cut on google, and
the *vast* majority say a byte is eight bits.


We forgot to do a web search before we chose that terminology in 1983.


I appreciate your sarcasm and have no desire to argue with anyone - and
most certainly not with you.

But wasn't the word byte pretty much introduced into the world by the IBM
360 in 1964 or thereabouts?


As others have pointed out in detail, byte is an old word. IBM's System/360,
introduced in the early 1960s, began the modern trend to eight-bit bytes
and byte-resolution arithmetic. Nevertheless, in the 1980s it was still not
uncommon to refer to "an x-bit byte machine", where x assumed quite a few
different values. Thus, the C Standard hardly plowed any new ground in
this area, and certainly didn't defy common parlance of the time.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
May 14 '06 #37
Chris Hills wrote:
Keith Thompson <ks***@mib.or g> writes
.... snip ...
If you think the current topicality guidelines should be changed,
*how* do you think they should be changed? Can you give specific
examples of things you think should be considered topical that
currently aren't? If there were a charter for this newsgroup,
what should it say?


That is a good idea.... can we draw up a charter? It would mean
people have to think about it. I did not replay to your "specific"
question as it needed some thought and I did not want to do an off
the cuff reply.

The problem is it is difficult to be specific on vaguely loosening
a tight spec. :-)


If you are going to make a proposal then I suggest you start from
"the tight spec". Remember that even now things involving POSIX
are adequately housed on comp.unix.progr amming (or such) and
windows (cursed be its name) on microsoft.*.

One loosening that might be worthwhile is advice on how to make
various almost-C compilers hew to the various standards, and their
failings.

--
"If you want to post a followup via groups.google.c om, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell. org/google/>
Also see <http://www.safalra.com/special/googlegroupsrep ly/>
May 14 '06 #38
In article <4c************ *@individual.ne t>, osmium
<r1********@com cast.net> writes
"Chris Hills" wrote:
Keith Thompson wrote:

If you think the current topicality guidelines should be changed,
*how* do you think they should be changed? Can you give specific
examples of things you think should be considered topical that
currently aren't? If there were a charter for this newsgroup, what
should it say?


That is a good idea.... can we draw up a charter? It would mean people
have to think about it. I did not replay to your "specific" question as
it needed some thought and I did not want to do an off the cuff reply.


<I *think* that pruning is right>

My guess is that the question is more along the lines of "If I gave you a
million dollars, what would you do with it?".


500K on wine, women and parties. Then just fritter the rest away :-)

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

May 14 '06 #39

Richard Heathfield wrote:
No, that almost certainly means simply that you've got a Windows text file
on a Linux system. Linux doesn't know, bless it, that you've been sullying
its filesystem with foreign muck. :-)


Sorry, I should have explained myself more clearly. At the moment I am
running on Windows with a Windows port of gcc. But, before I get
off-topic with environment specs, my real question is simply: does the
Standard require that stdin, stdout, and stdout be opened in a known
mode or is this detail left to the compiler? I ask because if I compile
the following (say as test.exe):

#include <stdio.h>

/* count occurences of '\r' in the input stream */
int main()
{
int c, count;
count = 0;
while ((c = getchar()) != EOF)
if(c == '\r')
++count;
printf("counted %d \\r's in input.\n", count);
return 0;
}

and I run the program with itself as input ("test < test.c"), the
result (on my machine) is

counted 12 \r's in input.

However, as I understand it, any '\r\n' sequences in the input stream
should have been mapped to '\n'. The only literature I can find
relating to this is what Microsoft has to say about how their C
compilers open stdin (they say it is opened in text mode in their
compilers). But what does the ANSI/ISO Standard say about what mode
stdin, stdout, and stderr are opened in? Maybe my compiler is just
misbehaving...

Mike S

May 14 '06 #40

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

Similar topics

8
3462
by: Bernhard Hidding | last post by:
Hi, my program writes chars to an ascii file via ofstream. You can use "\n" for newline and "\t" for tab there, but is there any command that deletes the last char in the current ofstream? Thanks in advance, Bernhard
2
3304
by: anirudhvr | last post by:
Hi, I needed a basic binary to ascii encoder, so I wrote this piece of code: /* Encoding algo: suppose 11111010 is the byte to be encoded. It is first broken up into two 4-bit parts (1111 and 1010) This 4-bit quantity is then padded between a 01 and a 10, ie, 01xxxx10 will be written out to the output file.
31
3238
by: Claude Yih | last post by:
Hi, everyone. I got a question. How can I identify whether a file is a binary file or an ascii text file? For instance, I wrote a piece of code and saved as "Test.c". I knew it was an ascii text file. Then after compilation, I got a "Test" file and it was a binary executable file. The problem is, I know the type of those two files in my mind because I executed the process of compilation, but how can I make the computer know the type of a...
6
10049
by: SandyMan | last post by:
Hi, I am able to open a binary file for reading but can someone tell me as how to go about converting a Binary file to ASCII file using C. Thanks In Advance SandyMan
5
10717
by: veg_all | last post by:
I have a script where a user can upload their csv file into a mysql database. The problem is sometimes a user will upload the raw excel or access file. How can I perform some simple checks to determine if the file is binary. I could do some regular expressions to check for unusual characters, but how would I read the file line by line?
1
1409
by: rsr | last post by:
Hi everybody, I have a VC++ application to connect two computers with a serial cable. Can anyone of u tell me which scheme of encoding is used to transmit data?..Binary or ASCII.. I guess its Binary as I am able to transmit even special characters like Δ(delta), alpha, beta..But I am not sure.. Thanks in advance
24
3024
by: pbd22 | last post by:
Hi. I want to know the size of a file (prior to FTP) in ASCII Mode. The reason is that I want to know how bit the file is going to be once it reaches the FTP server and there is a size difference between binary and ascii mode (100 or so bytes). So, how do I get the size of the file in ASCII Mode using the usual VB.NET API?
2
3900
by: tedpottel | last post by:
Hi, My program has the following code to transfer a binary file f = open(pathanme+filename,'rb') print "start transfer" self.fthHandle.storbinary('STOR '+filename, f) How can I do an ASCII file transfer?????? -Ted
1
2607
by: Vic | last post by:
I have a c program which writes mac address entries onto a text file. Text file when opened in vim looks like this index mac 1 ^@^@^Q^@^@^A ascii of (00.00.11.00.00.01) 2 ^@^@^Q^@^@^B ascii of (00.00.11.00.00.02) .. ........ Likewise I read the mac entries from the text file using a perl script and do some processing
0
9997
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
9845
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11279
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
10872
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
8047
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
5893
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4725
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
4307
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3323
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.