Binary IOStreams

G

Guest

No doubt this is another noobish kinda inquiry but here goes.

Is it possible or even desired to use IOStreams (in my case, out of academic
interest, network sockets) in a binary fashion? Right now it seems as I pull
single elements out of the stream ('>>') I"m not getting white space.

TY
 
S

Sharad Kala

No doubt this is another noobish kinda inquiry but here goes.

Is it possible or even desired to use IOStreams (in my case, out of
academic

Of course it is.
interest, network sockets) in a binary fashion? Right now it seems as I pull
single elements out of the stream ('>>') I"m not getting white space.

Open your stream specifying std::ios::binary.

-Sharad
 
S

Sharad Kala

Sharad Kala said:
Open your stream specifying std::ios::binary.

btw, generally shift operators are used for formatted i/o and different
functions are used for (unformatted) binary input/output.

-Sharad
 
J

Jonathan Turkanis

No doubt this is another noobish kinda inquiry but here goes.

Is it possible or even desired to use IOStreams (in my case, out of academic
interest, network sockets) in a binary fashion? Right now it seems as I pull
single elements out of the stream ('>>') I"m not getting white space.

Use the unformatted i/o functions, such as read and write, rather than the shift
operators.

Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top