I have a stream object, and I want to create and output xml using some kind of xml stream, based on data in my input stream.  I haven't done much work with streams, so I am trying to learn how to do this as efficiently as possible.  The idea is that I do not want to load the entire input stream in memory, then create the entire output st...
            
           
          
            
            I want to use this snippet from Mr-Edd's iostreams article to print std::clog somewhere.
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
int main()
{
    std::ostringstream oss;
    // Make clog use the buffer from oss
    std::streambuf *former_buff =
        std::clog.rdbuf(oss.rdbuf());
    std::clog <<...
            
           
          
            
            Hi,
I'd like to implement a custom manipulator for ostream to do some manipulation on the next item being inserted into the stream. For example, let's say I have a custom manipulator quote:
std::ostringstream os;
std::string name("Joe");
os << "SELECT * FROM customers WHERE name = " << quote << name;
The manipulator quote will quote n...
            
           
          
            
            So I've gotten the answer to my last question (I don't know why I didn't think of that).  I was printing a double using cout that got rounded when I wasn't expecting it.  How can I make cout print a double using full precision?
Thanks
...
            
           
          
            
            I'm wondering what techniques and/or library to use to implement the functionality of the linux command "tail -f ".  I'm essentially looking for a drop in add-on/replacement for java.io.FileReader.  Client code could look something like this:
TailFileReader lft = new TailFileReader("application.log");
BufferedReader br = new BufferedRea...
            
           
          
            
            How do I format my output in C++ streams to print fixed width left-aligned tables? Something like 
printf("%-14.3f%-14.3f\n", 12345.12345, 12345.12345);
poducing
12345.123     12345.123
...
            
           
          
            
            When using iostream in C++ on Linux, it displays the program output in the terminal, but in Windows, it just saves the output to a stdout.txt file. How can I, in Windows, make the output appear in the console?
...
            
           
          
            
            I'm trying to find a definitive answer and can't, so I'm hoping someone might know.
I'm developing a C++ app using GCC 4.x on Linux (32-bit OS).  This app needs to be able to read files > 2GB in size.
I would really like to use iostream stuff vs. FILE pointers, but I can't find if the large file #defines (_LARGEFILE_SOURCE, _LARGEFILE6...
            
           
          
            
            Can someone help me?
I am trying to do something like the following:
#include <boost/iostreams/tee.hpp>
#include <boost/iostreams/stream.hpp>
#include <sstream>  
#include <cassert>  
namespace io = boost::iostreams;
typedef io::stream<io::tee_device<std::stringstream, std::stringstream> > Tee;
std::stringstream ss1, ss2;
Tee my_split...
            
           
          
            
            How can I derive a class from cout so that, for example, writing to it
new_cout << "message";
would be equivalent to
cout << __FUNCTION__ << "message" << "end of message" << endl;
...
            
           
          
            
            I am using the Windows Driver Kit (WinDDK 6001.18001) to build my userspace application rather than Visual Studio 2005. I am taking this approach because we also have to build driver components, so I'd prefer to have a single build environment to build everything. Microsoft itself uses this approach for several products.
This was workin...
            
           
          
            
            Consider this program:
#include <iostream>
#include <string>
#include <sstream>
#include <cassert>
int main()
{
    std::istringstream stream( "-1" );
    unsigned short n = 0;
    stream >> n;
    assert( stream.fail() && n == 0 );
    std::cout << "can't convert -1 to unsigned short" << std::endl;
    return 0;
}
I tried this on gc...
            
           
          
            
            I am writing a small program for my personal use to practice learning C++ and for its functionality, an MLA citation generator (I'm writing a large paper with tens of citations). 
For lack of a better way to do it (I don't understand classes or using other .cpp files inside your main, so don't bother telling me, I'll work on that when I...
            
           
          
            
            I was thinking of "chaining" a couple of c++ iostreams toghether to filter input twice. I'm using gzstreams to read zlib compressed files and I was thinking of coding a stream that reads from a stream and performs encoding conversions. Perhaps by passing an opened stream as constructor parameter... How do you think this could be best acc...
            
           
          
            
            I'm working on a project for my company that uses a socket server (php) to gather data from a remote device.  How can I make this perl program run directly on the stream instead of first having the server write to a tmp file then running this script on that file then writing out a csv file for insertion into a database?
I thought about ...
            
           
          
            
            I have two simple programs set up that share data through a unix domain socket. One program reads data out of a Queue and sends it to the other application. Before it is sent each piece of data is front-appended by four bytes with the length, if it is less then four bytes the left over bytes are the '^' symbol. 
The client application t...
            
           
          
            
            Just out of curiosity, how does iostream access the input-output system.  (I have a bad habit of constantly reinventing the wheel, and I'm wondering if I can build a custom input-output system to the likes of iostream).
...
            
           
          
            
            I was trying std::cout.width(int) to see what it did, and it pushes the text right to fill a minimum width:
TH
becomes:
        TH
to fill a minimum width of 10. I am wondering if A) there is a way to reverse this, have a number of spaces put AFTER the text to fill a minimum width, and B) is there a way to create a maximum width AN...
            
           
          
            
            I've been given a homework assignment to write a program in C++, but we're not allowed to use the string class. However, we are allowed to use the iostream library, including stringstream. I was thinking of using stringstream where I would have used string for building my classes, returning from functions, etc.
Does this sound like a go...
            
           
          
            
            I have a function in C++ that takes in an std::istream as the input:
class Foo {
    Foo(std::istream &);
}
Using SWIG, I've bound it to Ruby, but Ruby's $stdin variable is fundamentally different from anything like the stream classes in C++, so I'm not sure how to either 1) expose the C++ class to Ruby in a way that I can use $stdin,...