473,785 Members | 2,829 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Binary-mode i/o, width of char, endianness

Hi group,

I'm having some difficulty figuring out the most portable way to read 24
bits from a file. This is related to a Base-64 encoding.

The file is opened in binary mode, and I'm using fread to read three
bytes from it. The question is though, where should fread put this? I
have considered two alternatives, but neither seem like a good idea:

In most cases, the width of a char is 8 bits, so an array of 3 chars
would suffice, but the width of a char is guaranteed to be only *at
least* 8 bits, so the actual number of chars required would be 24 /
CHAR_BIT, rounded up. Since you can't round in a constant integral
expression, 3 chars is a good safe buffer size because it's guaranteed
to be at least 24 bits. However, since I need to be able to divide
those 24 bits into four 6-bit numbers, indices into the char array
become more complicated as the 6-bit numbers do not fall evenly on the
(presumably) 8-bit boundaries that indexes in the array would give me.
If the width of a char is not 8 bits, then knowing which indices to look
at and shift/mask is even more difficult. As such, I thought of the
second option.

The second option is to allocate the input buffer as simply one int
object that is guaranteed to be at least 24 bits wide: the long int,
which even has 8 bytes to spare. fread can safely write 3 bytes of data
into a long int. I only have worries that because a long int is a
multi-byte integer, accessing various parts of it is dangerous due to
endianness considerations, or is endianness only relevant to the
represented *value* of the multi-byte integer as a whole? fread doesn't
care about that: it writes three bytes into the address of the long int,
starting at the lowest-positioned byte, but would the shifting/masking
be portable? For example a multi-byte integer constant 0x1234 has a
most-significant byte of value 0x12, but on a big-endian machine would
be stored on the *lowest* memory address of the space it takes up. As
such, the mask required to leave only the *lowest* 6 bits of a 32-bit
integer could be either 0x3F000000 or 0x0000003F depending on
endianness, right? Or are hexadecimal integer constants always stored
as-is? That is, the lowest byte is positioned last in an integer
constant instead of the least significant byte positioned last? This
seems counter-intuitive.

If neither of these options is good, is there another way?

Thanks in advance,
Thomas

Nov 14 '05 #1
15 2033
T Koster wrote:

Hi group,

I'm having some difficulty figuring out the most portable way to read 24
bits from a file. This is related to a Base-64 encoding.

The file is opened in binary mode, and I'm using fread to read three
bytes from it. The question is though, where should fread put this? I
have considered two alternatives, but neither seem like a good idea:

In most cases, the width of a char is 8 bits, so an array of 3 chars
would suffice, but the width of a char is guaranteed to be only *at
least* 8 bits, so the actual number of chars required would be 24 /
CHAR_BIT, rounded up. Since you can't round in a constant integral
expression, 3 chars is a good safe buffer size because it's guaranteed
to be at least 24 bits.
To store BITS bits, you need at least (BITS + CHAR_BIT - 1) / CHAR_BIT
bytes. If BITS is constant:

#define BITS 24

then:

unsigned char buf[(BITS + CHAR_BIT - 1) / CHAR_BIT] = {0};

is legal.
However, since I need to be able to divide
those 24 bits into four 6-bit numbers, indices into the char array
become more complicated as the 6-bit numbers do not fall evenly on the
(presumably) 8-bit boundaries that indexes in the array would give me.
So you need to mask and shift. If we assume that each octet of data
is stored in a separate byte, then this isn't as hard as it sounds.

/* 1. get bits 7 through 2 of first octet */
num[0] = (buf[0] & 0xFC) >> 2;
/* 2. get bits 1 and 0 of first octet, and bits 7 through 4 of
second octet */
num[1] = ((buf[0] & 0x03) << 6) | ((buf[1] & 0xF0) >> 4);

etc.
If the width of a char is not 8 bits, then knowing which indices to look
at and shift/mask is even more difficult.
See above if they're spread out, with 8 value bits to each byte
(the remaining bits being unused). If they're packed in, you just
have to be a little clever with CHAR_BIT. Once you start to analyse
this problem, you'll see that it isn't as hard as it sounds.
As such, I thought of the
second option.

The second option is to allocate the input buffer as simply one int
object that is guaranteed to be at least 24 bits wide: the long int,
which even has 8 bytes to spare.
Well, at least 8 *bits* to spare. :-)
fread can safely write 3 bytes of data
into a long int.


Not necessarily. On platforms such as the kind you are worrying about
(CHAR_BIT > 8), long int may well be fewer than four bytes wide!

Consider a platform with 11-bit bytes. On such a platform, long ints
may only occupy 3 bytes. On (perhaps more common) platforms with
16-bit or 32-bit bytes, long int may be only 2 bytes, or even 1 byte.

I would stick to unsigned char for this project. Long ints will
multiply your headaches, divide your attention, add to your
worries, and subtract from your understanding (modulo their
day-to-day uses, obviously).
Nov 14 '05 #2
infobahn wrote:
T Koster wrote:
I'm having some difficulty figuring out the most portable way to read 24
bits from a file. This is related to a Base-64 encoding.

The file is opened in binary mode, and I'm using fread to read three
bytes from it. The question is though, where should fread put this? I
have considered two alternatives, but neither seem like a good idea:

In most cases, the width of a char is 8 bits, so an array of 3 chars
would suffice, but the width of a char is guaranteed to be only *at
least* 8 bits, so the actual number of chars required would be 24 /
CHAR_BIT, rounded up. Since you can't round in a constant integral
expression, 3 chars is a good safe buffer size because it's guaranteed
to be at least 24 bits.
To store BITS bits, you need at least (BITS + CHAR_BIT - 1) / CHAR_BIT
bytes. If BITS is constant:

#define BITS 24

then:

unsigned char buf[(BITS + CHAR_BIT - 1) / CHAR_BIT] = {0};

is legal.


Ahh, good idea.
However, since I need to be able to divide
those 24 bits into four 6-bit numbers, indices into the char array
become more complicated as the 6-bit numbers do not fall evenly on the
(presumably ) 8-bit boundaries that indexes in the array would give me.


So you need to mask and shift. If we assume that each octet of data
is stored in a separate byte, then this isn't as hard as it sounds.

/* 1. get bits 7 through 2 of first octet */
num[0] = (buf[0] & 0xFC) >> 2;
/* 2. get bits 1 and 0 of first octet, and bits 7 through 4 of
second octet */
num[1] = ((buf[0] & 0x03) << 6) | ((buf[1] & 0xF0) >> 4);

etc.
If the width of a char is not 8 bits, then knowing which indices to look
at and shift/mask is even more difficult.


See above if they're spread out, with 8 value bits to each byte
(the remaining bits being unused). If they're packed in, you just
have to be a little clever with CHAR_BIT. Once you start to analyse
this problem, you'll see that it isn't as hard as it sounds.


We seem to be using the term 'byte' with different meanings...see below.
As such, I thought of the
second option.

The second option is to allocate the input buffer as simply one int
object that is guaranteed to be at least 24 bits wide: the long int,
which even has 8 bytes to spare.


Well, at least 8 *bits* to spare. :-)


Certainly :)
fread can safely write 3 bytes of data
into a long int.


Not necessarily. On platforms such as the kind you are worrying about
(CHAR_BIT > 8), long int may well be fewer than four bytes wide!

Consider a platform with 11-bit bytes. On such a platform, long ints
may only occupy 3 bytes. On (perhaps more common) platforms with
16-bit or 32-bit bytes, long int may be only 2 bytes, or even 1 byte.


Hmmm, this appears to be becoming a question of terminology. I thought
that by definition, one byte is eight bits wide. I'm not using the C
type 'char' interchangably with 'an int that is one _byte_ big'. When I
consider that CHAR_BIT may be greater than 8, I mean exactly that, and
not that a byte of storage on this platform has more than eight bits,
since I thought that was nonsense. That is, a char may occupy more than
one byte of storage, but a byte is still an 8-bit byte. Calling fread
and asking for three bytes implies that 24 bits will be read,
irrespective of platform, correct? As such, a long int, being
guaranteed to have at least 32 bits, is guaranteed to occupy at least
four bytes of storage, which is why I say that fread can safely store
three bytes (24 bits by definition) in a long int. Correct me if I'm
wrong here.
I would stick to unsigned char for this project. Long ints will
multiply your headaches, divide your attention, add to your
worries, and subtract from your understanding (modulo their
day-to-day uses, obviously).


Thanks,
Thomas.
Nov 14 '05 #3
T Koster wrote:
infobahn wrote:
T Koster wrote:
fread can safely write 3 bytes of data
into a long int.
Not necessarily. On platforms such as the kind you are worrying about
(CHAR_BIT > 8), long int may well be fewer than four bytes wide!
>
Consider a platform with 11-bit bytes. On such a platform, long ints
may only occupy 3 bytes. On (perhaps more common) platforms with
16-bit or 32-bit bytes, long int may be only 2 bytes, or even 1 byte.


Hmmm, this appears to be becoming a question of terminology. I thought
that by definition, one byte is eight bits wide.


Not in comp.lang.c, it isn't, because ISO C recognises that it
simply isn't true on some platforms.
I'm not using the C
type 'char' interchangably with 'an int that is one _byte_ big'. When I
consider that CHAR_BIT may be greater than 8, I mean exactly that, and
not that a byte of storage on this platform has more than eight bits,
since I thought that was nonsense.
Many people think that, and many people are wrong. If CHAR_BIT is
greater than 8, it is because bytes are greater than 8 bits wide
for that implementation.
That is, a char may occupy more than
one byte of storage, but a byte is still an 8-bit byte.
In C, by definition, a char is exactly one byte in size.
sizeof(char) always yields 1 as its value. But chars can
be wider than 8 bits. If they are, then so are bytes.
Calling fread
and asking for three bytes implies that 24 bits will be read,
irrespective of platform, correct?
Nope. Consider a typical modern DSP. You might get anything from
48 to 96 bits! (Maybe even more, nowadays.)
As such, a long int, being
guaranteed to have at least 32 bits, is guaranteed to occupy at least
four bytes of storage, which is why I say that fread can safely store
three bytes (24 bits by definition) in a long int. Correct me if I'm
wrong here.


You can certainly guarantee to get 24 bits into a long int, yes.
But you might not need three bytes to do it in, and if you read
three bytes you might end up with more than you can chew.

(Pun definitely intended.)
Nov 14 '05 #4
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

T Koster wrote:
infobahn wrote: [snip]
Consider a platform with 11-bit bytes. On such a platform, long ints
may only occupy 3 bytes. On (perhaps more common) platforms with
16-bit or 32-bit bytes, long int may be only 2 bytes, or even 1 byte.

Hmmm, this appears to be becoming a question of terminology.


Yes. This is one of those difference in terms that catches a lot of people.
I thought
that by definition, one byte is eight bits wide.
Not in the C language, although your observation holds true in many
other areas of computing.

Here, a byte is as wide as a byte is wide, and that is 8 bits /or more/.
I'm not using the C
type 'char' interchangably with 'an int that is one _byte_ big'.
A C char data type is, by definition, one byte big. A byte, however, has
no defined size, other than a minimum size of 8 bits. A byte (and hence
a char) could be 9 bits wide, or 32 bits wide, or even 64 bits wide,
depending on the implementation.
When I
consider that CHAR_BIT may be greater than 8, I mean exactly that,
As do we
and
not that a byte of storage on this platform has more than eight bits,
There may be a difference between the machine's minimum unit of
addressable memory and the minimum unit of addressable memory that the C
'virtual machine' recognizes. Here, in comp.lang.c, the C 'virtual
machine' interpretation wins, and a byte is CHAR_BIT bits long, no
matter how the physical machine implements it's load and store
instructions. Think of it this way, in C, you can't get any smaller a
single unit of memory than a char, so a char /is/ the minimum unit of
addressable memory.
since I thought that was nonsense.
I'll let this pass :-)
That is, a char may occupy more than
one byte of storage, but a byte is still an 8-bit byte.
Difference in terms. A byte is CHAR_BIT bits long, and that can be more
than 8 bits.
Calling fread
and asking for three bytes implies that 24 bits will be read,
irrespective of platform, correct?
Nope. Calling fread(,3,1,) (one element, 3 char in length) will read one
block of 3 C char elements. If each C char element is 24 bits long
(CHAR_BIT == 24), then you get 72 bits worth of data in one fread().
As such, a long int, being
guaranteed to have at least 32 bits, is guaranteed to occupy at least
four bytes of storage,
No, is guaranteed to occupy at least CHAR_BIT * sizeof(long int) bits of
storage, or sizeof(long int) bytes of storage.
which is why I say that fread can safely store
three bytes (24 bits by definition) in a long int.
Correct me if I'm wrong here.


See above.
- --

Lew Pitcher, IT Specialist, Enterprise Data Systems
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFCJHGHagV FX4UWr64RAvZUAJ 9kwiCwxKiEY5RJI fHSwpMc75u+zQCf bDbx
Ezd/+ESWGlZovKGmMNo/DzQ=
=2v7/
-----END PGP SIGNATURE-----
Nov 14 '05 #5
infobahn <in******@btint ernet.com> writes:
T Koster wrote:

[...]
Hmmm, this appears to be becoming a question of terminology. I thought
that by definition, one byte is eight bits wide.


Not in comp.lang.c, it isn't, because ISO C recognises that it
simply isn't true on some platforms.
I'm not using the C
type 'char' interchangably with 'an int that is one _byte_ big'. When I
consider that CHAR_BIT may be greater than 8, I mean exactly that, and
not that a byte of storage on this platform has more than eight bits,
since I thought that was nonsense.


Many people think that, and many people are wrong. If CHAR_BIT is
greater than 8, it is because bytes are greater than 8 bits wide
for that implementation.


That's not quite the way I'd put it. The fact that a "byte" is
defined to be CHAR_BIT bits isn't necessarily something imposed by the
underlying platform; it's a choice that can be made by the author of
the C implementation. It's about the definition of the word "byte",
not necessarily about any inherent attribute of the platform.

For example, I've worked on systems where the natural fundamental unit
of storage is 64 bits, but the C implementation defines CHAR_BIT==8.
It has to jump through some hoops to make this work; the advantage is
compatibility with other systems.

The C standard could have defined the term "byte" as a unit of storage
consisting of 8 bits.

The end result is the same, though. Out in the real world a "byte" is
almost always 8 bits ("octet" is an unambiguous term for this). In
comp.lang.c, a "byte" is always exactly CHAR_BIT bits, and maximally
portable code must not assume that CHAR_BIT==8.

--
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.
Nov 14 '05 #6
Keith Thompson wrote:

infobahn <in******@btint ernet.com> writes:
If CHAR_BIT is
greater than 8, it is because bytes are greater than 8 bits wide
for that implementation.
That's not quite the way I'd put it. The fact that a "byte" is
defined to be CHAR_BIT bits isn't necessarily something imposed by the
underlying platform; it's a choice that can be made by the author of
the C implementation.


That's why I said "implementation ", not "platform".
It's about the definition of the word "byte",
not necessarily about any inherent attribute of the platform.
That's why I said "implementation ", not "platform".
For example, I've worked on systems where the natural fundamental unit
of storage is 64 bits, but the C implementation defines CHAR_BIT==8.
It has to jump through some hoops to make this work; the advantage is
compatibility with other systems.


Cray, by any chance?
Nov 14 '05 #7
infobahn wrote:
T Koster wrote:
infobahn wrote:
T Koster wrote:
fread can safely write 3 bytes of data
into a long int.

Not necessarily. On platforms such as the kind you are worrying about
(CHAR_BIT > 8), long int may well be fewer than four bytes wide!

Consider a platform with 11-bit bytes. On such a platform, long ints
may only occupy 3 bytes. On (perhaps more common) platforms with
16-bit or 32-bit bytes, long int may be only 2 bytes, or even 1 byte.


Hmmm, this appears to be becoming a question of terminology. I thought
that by definition, one byte is eight bits wide.


Not in comp.lang.c, it isn't, because ISO C recognises that it
simply isn't true on some platforms.
I'm not using the C
type 'char' interchangably with 'an int that is one _byte_ big'. When I
consider that CHAR_BIT may be greater than 8, I mean exactly that, and
not that a byte of storage on this platform has more than eight bits,
since I thought that was nonsense.


Many people think that, and many people are wrong. If CHAR_BIT is
greater than 8, it is because bytes are greater than 8 bits wide
for that implementation.
That is, a char may occupy more than
one byte of storage, but a byte is still an 8-bit byte.


In C, by definition, a char is exactly one byte in size.
sizeof(char) always yields 1 as its value. But chars can
be wider than 8 bits. If they are, then so are bytes.
Calling fread
and asking for three bytes implies that 24 bits will be read,
irrespectiv e of platform, correct?


Nope. Consider a typical modern DSP. You might get anything from
48 to 96 bits! (Maybe even more, nowadays.)
As such, a long int, being
guaranteed to have at least 32 bits, is guaranteed to occupy at least
four bytes of storage, which is why I say that fread can safely store
three bytes (24 bits by definition) in a long int. Correct me if I'm
wrong here.


You can certainly guarantee to get 24 bits into a long int, yes.
But you might not need three bytes to do it in, and if you read
three bytes you might end up with more than you can chew.

(Pun definitely intended.)


Okay okay, so it is impossible to portably tell fread to read exactly 24
bits of data, since you can only ask it to give you an integer number of
bytes, however big they may be on the particular implementation.

As such, should I allocate a larger buffer, of a fixed number of bytes
(regardless of how wide a byte is), and get fread to read in that fixed
number of bytes, and then do the shifting/masking as appropriate
depending on CHAR_BIT, reading more data as needed?

Also, will I need to generate the masks as expressions in terms of
CHAR_BIT, rather than a hexadecimal integer constant? The mask 0xFC
(for the first six bits) defines only 8 bits worth of a char, which we
know can be wider than 8 bits.
Would something like
x[0] = (buf[0] >> (CHAR_BIT - 6)) & 63;
be more appropriate? What about the next six bits? With an 8-bit char,
four bits will have to come from buf[1], but with a 12-bit-or-more char
buf[0] has all we need. In general, I guess since a char is at least
eight bits wide, we only need to examine at most two chars. I'm just
trying to figure out some sort of expression for x[n] (any nth 6-bit
number contained in the 'stream' of chars). I'll have to think about
this one.

Thanks,
Thomas

Nov 14 '05 #8
In article <S7************ ********@news-server.bigpond. net.au>,
T Koster <re************ @use.net> wrote:
:Okay okay, so it is impossible to portably tell fread to read exactly 24
:bits of data, since you can only ask it to give you an integer number of
:bytes, however big they may be on the particular implementation.

:As such, should I allocate a larger buffer, of a fixed number of bytes
:(regardless of how wide a byte is), and get fread to read in that fixed
:number of bytes, and then do the shifting/masking as appropriate
:depending on CHAR_BIT, reading more data as needed?

You could find the lowest common multiple of 24 and CHAR_BIT
(e.g., 72 for CHAR_BIT==9, 120 for CHAR_BIT==10, 282 for CHAR_BIT==11,
24 for CHAR_BIT==12). Divide that by CHAR_BIT and you get the number
of bytes you need to read at a time in order to be able to unpack
on exact boundaries.
:I'm just
:trying to figure out some sort of expression for x[n] (any nth 6-bit
:number contained in the 'stream' of chars).

if ( (n * 6) % CHAR_BIT < 6 ) then you need to span bytes.
--
Beware of bugs in the above code; I have only proved it correct,
not tried it. -- Donald Knuth
Nov 14 '05 #9
T Koster <re************ @use.net> writes:
[...]
Okay okay, so it is impossible to portably tell fread to read exactly
24 bits of data, since you can only ask it to give you an integer
number of bytes, however big they may be on the particular
implementation.

As such, should I allocate a larger buffer, of a fixed number of bytes
(regardless of how wide a byte is), and get fread to read in that
fixed number of bytes, and then do the shifting/masking as appropriate
depending on CHAR_BIT, reading more data as needed?

[...]

I wonder how much effort this is worth. I don't know of any hosted C
implementations with CHAR_BIT != 8 (and freestanding implementations
don't necessarily support fread).

If you want absolute portability, you need to write your code so it
works on systems with CHAR_BIT != 8. But then it's not clear what a
data file would look like after being copied to such a system.
Whatever mechanism is used to copy the file will need to deal with the
difference in byte sizes, and there are a number of ways it could do
so. If CHAR_BIT % 8 == 0, it could pack multiple octets into each
byte. If not, it could either treat the file as a stream of bits
(with some octets crossing byte boundaries), or it could just store
each octet in a byte and zero out the high-order bits.

It might be sufficient to put the following code in an application
header file:

#include <limits.h>
#if CHAR_BIT != 8
#error This application is supported only on systems with CHAR_BIT==8
#endif

On the other hand, if this is intended as an exercise in theoretical
manic portability, have fun!

--
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.
Nov 14 '05 #10

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

Similar topics

4
6004
by: Paul | last post by:
Hi, (First apologies if this is not the most relevant place to post this but I wasn't sure of where was and I am writing my app in VB.) I'm attempting to parse a binary file for which I have the format. The format states that the general packet format is as follows Message header Hex Length of whole binary packet
13
15262
by: yaipa | last post by:
What would be the common sense way of finding a binary pattern in a ..bin file, say some 200 bytes, and replacing it with an updated pattern of the same length at the same offset? Also, the pattern can occur on any byte boundary in the file, so chunking through the code at 16 bytes a frame maybe a problem. The file itself isn't so large, maybe 32 kbytes is all and the need for speed is not so great, but the need for accuracy in the...
2
2352
by: Jeff Brooks | last post by:
I was curious what you guys think about binary formats vs text formats. Does the fact that the XML standards body is looking into binary XML affect any of your views? Information about their binary work is available here: http://www.w3.org/XML/Binary/ Jeff Brooks
1
3407
by: Jerry Khoo | last post by:
hello, everybody, i am kinda new here, nice to meet u all. Now, i am > cs students and are now facing difficult problems in understanding > what a binary tree is, how it works, and the algorithm to display, > arrange, find, delete the leaf node in binary tree. > > I hope that anyone with expereince in building binary tree could help > me in explaining the binary tree functions, and give a sample code of > the whole picture behind the...
2
2534
by: Lisa Pearlson | last post by:
Hi, My php application (on Apache/Linux) needs to do the following: The PHP script receives a request from a client (binary), asking for certain records of data. My PHP script loops through all records and sends each of them ONE BY ONE. After each record that my server script sends, it waits for the client to confirm proper reception with an ACK (binary digit). When there are no more records, my server script sends the client a binary
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.
7
6063
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should populate a series of structures of specified variable composition. I have the structures created OK, but actually reading the files is giving me an error. Can I ask a simple question to start with: I'm trying to read the file using the...
5
2916
by: bwv539 | last post by:
I have to output data into a binary file, that will contain data coming from a four channel measurement instrument. Since those data have to be read from another C program somewhere else, the reading program must know how many channels have been acquired, date, time, and so on. I mean that the position of each datum is not fixed in the file but depends on the conditions when acquired. That is, I need something like a header in the file to...
16
4501
by: Erwin Moller | last post by:
Why is a binary file executable? Is any binary file executable? Is only binary file executable? Are all executable files binary? What is the connection between the attribute of binary and that of executable?
7
3871
by: Vinodh | last post by:
Started reading about Binary Trees and got the following questions in mind. Please help. Definition of a Binary Tree from "Data Structures using C and C++ by Tanenbaum" goes like this, "A binary tree is a finite set of elements that is either empty or is partitioned into three disjoint subsets. The first subset contains a single element called the 'Root' of the tree. The other two subsets are themselves binary trees, called the 'Left'...
0
9645
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
9480
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
10327
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
10151
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...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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.