Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make the difference between a binary and an ASCII buffer?

Status
Not open for further replies.

AliFessi

Programmer
Jul 3, 2001
12
DE
Hi there,

I am writing program that reads data from a "const char * buf" in a loop.

If the content of this buffer is in ASCII-Code, it has to be displayed on the screen. If it is in binary mode, it doesn't make sense to display it.

So in this case, I want just to display some information about the buffer, for example its length.

The problem is: how to know if the content of the buffer is in binary mode or ASCII?

Thanx in advance!
 
The difference is only in how do you treat symbols from the buffer. Also in an ASCII buffer the character '\0' usually means its end. There could be any characters hat means buffer end. Also in ASCII mode some symbols means something different, for example spaces, new lines, returns... There is no way to difference them from the program. You could do it only taking a look over them. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top