ostream Questions

1

Solved

I'm trying to make a Vector3D class in my c++ application. For my entire program, I'm using a namespace. In this namespace I've declared my Vector3D class and an overloaded operator<< for it ...
Belgrade asked 7/10, 2011 at 22:41

2

Solved

Im currently anwsering exercise questions concerning operator overloading in C++. I have a question: Create a simple class containing an int and overload the operator+ as a member function. Also p...
Whimwham asked 24/8, 2011 at 16:44

2

Solved

I am using an abstract class std::ostream. There is the following reference: std::ostream &o = std::cout; If any condition is met I need to initialize o so that the output will be redirecte...
Cuisse asked 2/8, 2011 at 9:23

2

Solved

I'm writing a C++ program and I need some help understanding an error. By default, my program prints to the terminal (STDOUT). However, if the user provides a filename, the program will print to t...
Balkh asked 23/6, 2011 at 16:37

3

Solved

It is well known that the user can define stream manipulators like this: ostream& tab(ostream & output) { return output<< '\t'; } And this can be used in main() like this: cout&...
Lucilucia asked 8/1, 2011 at 12:32

3

Solved

Possible Duplicate: Implementing a no-op std::ostream Is there any stream equivalent of NULL in c++? I want to write a function that takes in a stream if the user wants to have the in...
Lessielessing asked 5/6, 2011 at 4:8

3

Solved

I'm currently using the very clever package boost::const_string until http://libcxx.llvm.org/ is available pre-packaged on Ubuntu or GCC make its __versa_string (in header ext/vstring.h) its defaul...
Exterior asked 20/4, 2011 at 13:30

1

Solved

I have been doing research on creating my own ostream and along with that a streambuf to handle the buffer for my ostream. I actually have most of it working, I can insert (<<) into my stream...
Rachal asked 12/4, 2011 at 21:52

6

Solved

I have to use a parser and writer in c++, i am trying to implement the functions, however i do not understand what a token is. one of my function/operations is to check to see if there are more tok...
Overuse asked 12/4, 2011 at 17:24

4

Solved

Is there a way in C++ to check if an ostream object is cout or a ofstream object? Something like: ostream& output(ostream& out) { if (out == cout) return out; else { out << "so...
Johnettajohnette asked 23/7, 2010 at 13:49

2

Solved

trying to get the operator to work, but throwing me bunch of errors: my header file template <unsigned short n> class Vector { public: std::vector<float> coords; Vector(); Vector(...
Anthology asked 12/3, 2011 at 18:18

2

Solved

I created a class Chromosome that ended up simply being a wrapper for vector with an ostream operator, so I've decided to typedef vector instead. However, I'm having trouble with the templated ostr...
Slothful asked 12/2, 2011 at 1:33

5

Solved

The overloaded << works if I make it into an inline function. But how do I make it work in my case? #include <iostream> using namespace std; template <class T> T my_max(T a, T b)...
Grayback asked 11/1, 2011 at 16:45

3

Solved

In order to use cout as such : std::cout << myObject, why do I have to pass an ostream object? I thought that was an implicit parameter. ostream &operator<<(ostream &out,...
Simoneaux asked 3/12, 2010 at 16:50

4

Solved

I have a homework assignment where the header file is provided to us, and is unchangeable. Im having trouble figuring out how to correctly use a "display" function, so here is the relevant code. T...
Disport asked 18/11, 2010 at 16:26

2

Solved

Is there a way to set the "minimum" number of decimal places that a std::ostream will output? For example, say I have two unknown double variables that I want to print (values added here for the s...
Kimberlykimberlyn asked 22/3, 2010 at 2:4

2

Solved

I have a class in C++ which takes an std::ostream as an argument in order to continuously output text (trace information). I need to get this text over to the Java side as efficiently as possible. ...
Coal asked 24/2, 2010 at 17:35

2

Solved

I tried the following code: #include <iostream> using std::cout; using std::ostream; class X { public: friend ostream& operator<<(ostream &os, const X& obj) { cout &lt...
Obbard asked 1/3, 2010 at 10:58

3

Solved

I have a class with a bool data member that is not initialized by the constructor. If I do cout << x.myBoolDataMember; where x is an object of this class in which the bool has not been ini...
Prostyle asked 28/1, 2010 at 11:37

3

Solved

I am trying to use the map container in C++ in the following way: The Key is a string and the value is an object of type ofstream. My code looks as follows: #include <string> #include <io...
Knar asked 30/11, 2009 at 12:41

3

Solved

For educational purposes I want to create a ostream and stream buffer to do: fix endians when doing << myVar; store in a deque container instead of using std:cout or writing to a file lo...
Commentative asked 7/2, 2009 at 21:45

3

Solved

I have a C++ class MyObject and I want to be able to feed this data like I would to a osstream (but unlike a direct sstream, have the incoming data be formatted a special way). I can't seem to figu...
Complexioned asked 5/5, 2009 at 2:12

4

Solved

I am trying to create a c++ ostream for educational reasons. My test will be creating an ostream that acts like a ofstream would except instead of writing to a file it would write to a deque or vec...
Sleeve asked 7/2, 2009 at 20:32

© 2022 - 2024 — McMap. All rights reserved.