Is there a limited-length string class around? I've searched a
little on the net and didn't find anything. I'm interested in a
class that limits (possibly at compile time) the length to 255,
so marshalling the string's length only requires one byte.
...
Here is the header for a class I started:
#ifndef CANVAS_
#define CANVAS_
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
class Canvas
{
public:
Canvas();
void Paint(int R, int C, char Color);
const int Nrow;
const int Ncol;
string Title;
int image[][100];
stack<int> path;
struct PixelCoord...
I want to format a drive in c++, but when I tried to use Format function of windows.h I could not find a sample or the way of using that.
I also don't want to interact by user in order to get ok or cancel so I cannot use SHFormat
Does anyone know how can I do that?
...
I currently have the following code:
using boost::bind;
typedef boost::signal<void(EventDataItem&)> EventDataItemSignal;
class EventDataItem
{
...
EventDataItemSignal OnTrigger;
...
}
typedef std::list< shared_ptr<EventDataItem> > DataItemList;
typedef std::list<boost::signals::connection> ConnectionList;
class MyClass
{
void OnSta...
I've got a simple class Currency with overloaded operator<<. I don't know how can i separate the number with spaces every 3 digits, so it looks like: "1 234 567 ISK".
#include <cstdlib>
#include <iostream>
using namespace std;
class Currency
{
int val;
char curr[4];
public:
Currency(int _val, const char * _curr)
{...
Hi there,
I'm new to developing in C++. I've developed a dll where I'm using curllib to make HTTP requests.
When running the dll via depend.exe it notifies me that my dll now depends on the curllib.dll. This simply doesn't work for me. My dll is set as a static library not shared and will be distributed on its own. I cannot rely on a ...
We use tolua++ to generate Lua bindings for C++ classes.
Assume I have a C++ class:
class Foo
{
//Some methods in Foo, irrelevant to question.
};
and a tolua .pkg file with the following contents
class Foo
{
};
Consider the following function:
void call_some_lua_function(lua_State* luaState)
{
Foo* myFoo = new Foo();
...
I am working on a research project that deals with social networks. I have done most of the backbone of the program in C++ and am now wanting to implement a way to create the graph of nodes and the connections as well as a way to visualize the connections between people. I have looked a little into Lemon and the Boost graph library, but ...
Hi there,
I've tried using curllib, but find my dll becomes dependent on curllib.dll. Is there another method I can investigate and use? I simply want to make a request to a web page. My dll has to be independant so it can be distributed on its own.
Thanks
...
The problem is that I want to output Mathematica compatible floating point numbers. The only difference with the standard IOStream or printf output format is that the exponential e is replaced by *^:
Standard C/C++ output format: 1.23e-4
Mathematica format: 1.23*^-4
Is there a way to manipulate streams to achieve this effect? My origi...
I've been reading recently about DI and IoC in C++. I am a little confused (even after reading related questions here on SO) and was hoping for some clarification.
It seems to me that being familiar with the STL and Boost leads to use of dependency injection quite a bit. For example, let's say I made a function that found the mean of a ...
Hi, I'm relative new to C++ and my background is in Java. I have to port some code from Java to C++ and some doubts came up relative to the Object Java's class. So, if I want to port this:
void setInputParameter(String name, Object object) { ..... }
I believe I should use void* type or templates right? I don't know what's the "standar...
I have some big numbers (again) and i need to find if the sum of the digits is an even number.
I tried this: finding the sum of the digits with a while loop and then checking if that sum % 2 equals 0 and it's working but it's too slow for big numbers, because i am given intervals of numbers and if the input is 1999999 19999999999 then m...
I have a question relating to databases and at what point is worth diving into one. I am primarily an embedded engineer, but I am writing an application using Qt to interface with our controller.
We are at an odd point where we have enough data that it would be feasible to implement a database (around 700+ items and growing) to manage...
I need help passing binary data into Java. I'm trying to use jbytearray but when the data gets into Java it appears corrupt. Can somebody give me a hand?
Here's a snip of some example code. First the native C++ side:
printf("Building audio array copy\n");
jbyteArray rawAudioCopy = env->NewByteArray(10);
jbyte toCopy[10];
printf("Fillin...
Looking at n3092, in §6.5.4 we find the equivalency for a range-based for loop. It then goes on to say what __begin and __end are equal to. It differentiates between arrays and other types, and I find this redundant (aka confusing).
It says for arrays types that __begin and __end are what you expect: a pointer to the first and a pointer...
This does not segment fault, but it is not reading the pixels of the "original" file.
Image Image::scaleUp(int numTimes) const
{
Image newImage(width*numTimes, height*numTimes);
newImage.createImage(width*numTimes, height*numTimes);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {...
I'm curious as to the procedure for writing browser plugins for browsers like Chrome, Safari, and Opera. I'm thinking specifically of Windows here and would prefer working with C++.
Are there any tools or tutorials that detail the process?
Note: I am not referring to extensions or 'addons'. I'm referring to a plugin similar to how ...
The copy assignment operator has the usual signature:
my_class & operator = (my_class const & rhs);
Does the following signature have any practical use?
my_class const & operator = (my_class const & rhs);
You can only define one or the other, but not both.
...
If I get some value by using getline( cin, myStr ); a newline is printed after the information the user entered - logically as he pressed enter:
Please enter something: ABC <enter => \n>
This text is printed out by the program and should be in the same line as before
How to keep the newline after user input away?
I'm using MSVC 201...