What is the difference between ios::hex and std::hex?


 
Thread Tools Search this Thread
Top Forums Programming What is the difference between ios::hex and std::hex?
# 1  
Old 03-26-2011
What is the difference between ios::hex and std::hex?

Hi,

Is there really a difference between these two, std::hex and ios::hex??

I stumbled upon reading a line, "std::ios::hex is a bitmask (8 on gcc) and works with setf(). std::hex is the operator". Is this true?

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to replace with "sed" some hex values by other hex values?

Assume I have a file \usr\home\\somedir\myfile123.txt and I want to replace all occurencies of the two (concatenated) hex values x'AD' x'A0' bytwo other (concatenated) hex values x'20' x'6E' How can I achieve this with the gnu sed tool? Additional question: Is there a way to let sed show... (1 Reply)
Discussion started by: pstein
1 Replies

2. UNIX for Dummies Questions & Answers

How to specify a FS as HEX value in AWK

Hi All, I have one input file seperated with Hex decimal B1 value. And i want to process this file. And iam creating an awk script to process this file. How can I specify the Field seperator as HEX B1 in my awk. Please help. Thanks in advance.:) (2 Replies)
Discussion started by: psk_kumar
2 Replies

3. Programming

Problem with istringstream.setf(ios::hex)

Hi, I am trying to converting a string containing a hexadecimal format to int using the below code. #include <iostream> #include <sstream> #include <string> using namespace std; int main( ) { unsigned int num = 0; istringstream iss(string("0xF")); iss.setf(ios::hex); iss... (0 Replies)
Discussion started by: royalibrahim
0 Replies

4. Programming

ascii to hex

Hello guys, i want to convert a text file to hex and have written this code : int main(int argc, char **argv) { ifstream file; string fileName = "CODEZ"; file.open(fileName.c_str()); // oeffen im Text-Modus if(file) {... (5 Replies)
Discussion started by: Kingbruce
5 Replies

5. Programming

After converting the hexstr to Hex and storing the Hex in a char*

Hi All, My main intension of is to convert the Hexstring stored in a char* into hex and then prefixing it with "0x" and suffix it with ',' This has to be done for all the hexstring char* is NULL. Store the result prefixed with "0x" and suffixed with ',' in another char* and pass it to... (1 Reply)
Discussion started by: rvan
1 Replies

6. Shell Programming and Scripting

hex to decimal

hi all, echo "ibase=16;obase=10;11" | bc shouldn't i get 17? i am getting 11 i am trying to convert 11 (hex) to decimal stuck! JAK (4 Replies)
Discussion started by: jakSun8
4 Replies

7. UNIX for Dummies Questions & Answers

Hex editing

Hi, I am new to UNIX. I have a text file where each line ends on the hexadecimal character "0A". In the file there are some records that contain the Hex characters "0D0A" which I need to replace by Hex "20". Is there a simple way to do this? Regards, Swanie (3 Replies)
Discussion started by: Swanie
3 Replies

8. Shell Programming and Scripting

Hex Conversion

I need to have my scripts import volume groups and mknod devices files. I have most of the script working but the device file needs to be in the format 0x??0000 (where the question marks are my HEX representations of the volume group number. I have the code below and the output it produces which... (2 Replies)
Discussion started by: insania
2 Replies

9. Shell Programming and Scripting

Looking for a hex character?

Hi guys , i would want to count the concurrences of the 0A hex char in a text file , then if no matches i need to add a 0A at the end of the line. Any ideas? thx.Regards (1 Reply)
Discussion started by: Klashxx
1 Replies

10. UNIX for Dummies Questions & Answers

Ascii To Hex

How will I display on screen a UNIX ascii file with its HEX equivalent. I want to check whether 0D 0A is coming at the end of the file which I am generating from UNIX. (1 Reply)
Discussion started by: augustinep
1 Replies
Login or Register to Ask a Question
FBB::IOStreambuf(3bobcat)					   Error handler					 FBB::IOStreambuf(3bobcat)

NAME
FBB::IOStreambuf - streambuf allowing input and output operations SYNOPSIS
#include <bobcat/iostreambuf> Linking option: -lbobcat DESCRIPTION
This class implements a specialization of the std::streambuf class, allowing input operations from and output operations to different files. It is intended to be used in combination with FBB::IOStream, thus allowing all stream-based input and output operations using the same object without the need to use seek-operations. Using an FBB::IOStream object it is, e.g., possible to construct two-way communica- tions using pipes, much like the facilities offered by sockets. If the streams that will be associated with the IOStreambuf object support seeking, then the IOStreambuf will do so to. Seeking might also be availble for a single stream (either the std::istream or the std::ostream). When the IOStreambuf object goes out of scope, its associated std::ostream object is flushed. NAMESPACE
FBB All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB. INHERITS FROM
std::streambuf CONSTRUCTORS
o IOStreambuf(): The default constructor results in a IOStreambuf object that cannot be immediately used. Its member open() must be called first. o IOStreambuf(std::istream &in, std::ostream &out): This constructor associates the IOStreambuf object with a std::istream and a std::ostream. All output operations will be passed on to the std::ostream, all input operations to the std::istream. The streams passed to IOStreambuf() should outlive the IOStreambuf object. De copy constructor is available as well. MEMBER FUNCTIONS
All members of std::streambuf are available, as FBB::IOStreambuf inherits from these classes. o void open(std::istream &in, std::ostream &out): This member (re)associates the IOStreambuf object with a std::istream and a std::ostream. All output operations will be passed on to the std::ostream, all input operations to the std::istream. The streams passed to IOStreambuf() should outlive the IOStreambuf object. If this member is called for an IOStreambuf object already associated with an std::ostream object, the already associated std::ostream object is flushed before setting up the new association. VIRTUAL PROTECTED MEMBER FUNCTIONS
The following std::streambuf member functions should only be called when the FBB::Streambuf object is associated with std::istream and std::ostream objects (i.e., they should not be called between the construction of a default FBB:IOStreambuf object and a subsequent call of IOStreambuf::open()): The members listed in this section implement the tasks of comparably named virtual function in the class's private interface. This sepa- rates the redefinable interface from the user-interface. The class IOStreamBuf can, in accordance with Liskov's Substitution Principle, be used as a std:streambuf; but it also offers facilities for classes deriving from IOStreamBuf. These facilities are listed here. o pos_type pSeekoff(off_type offset, std::ios::seekdir way, std::ios::openmode mode = std::ios::in | std::ios::out): With seekable streams, repositions the associated std::istream or std::ostream is repositioned to offset offset, relative to way. o pos_type pSeekpos(off_type offset, std::ios::openmode mode = std::ios::in | std::ios::out): With seekable streams, repositions the associated std::istream or std::ostream is repositioned to offset offset, relative to the beginning of the stream. o int pSync(): This member flushes the associated std::ostream object. o std::streamsize pXsputn(char const *buffer, std::streamsize n): This member inserts n characters from buffer into the associated std::ostream stream. EXAMPLE
See the example provided with process(3bobcat). FILES
bobcat/iostreambuf - defines the class interface SEE ALSO
bobcat(7), iostream(3bobcat), process(3bobcat) BUGS
None reported. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::IOStreambuf(3bobcat)