I have a string which I want to copy into a fixed length string.
For example I have a string s = "this is a string" that is 16 characters long
I want to copy this into a fixed length string s2 that is 4 characters long. So s2 will contain "this"
I also want to copy it into a fixed length string s3 that is 20 characters long. The end...
When I use function-level linking in VC++ for a simple project it's more or less clear how it works. But what if I build an executable that depends on a static library and both are compiled with VC++?
For example, if the static library had function-level linking enabled and the executable has it disabled or vice versa - how will it work...
I'm trying to achieve an effect where there's a visible logo inside an edit control and the logo becomes hidden when the user places the focus on the edit control.
What's the best way to approach this? Would it be better to place an image control on top of the edit control or paint the background of the edit control transparent and pos...
I m looking for a faster implementation or good a approximation of functions provided by cmath.
I need to speed up the following functions
pow(x,y)
exp(z*pow(x,y))
where z<0. x is from (-1.0,1.0) and y is from (0.0, 5.0)
...
I have a dependancy library (libfcgi) that I compiled with g++ (GCC v4.4 MinGW) using the following calls:
g++ -Iinclude -c -O2 *.c
ar rcs ../libfcgi.a *.o
Now, my main project is built like so:
g++ -Idependancies\libfcgi\include -Ldependancies -O2 -lfcgi *.cpp
g++ apparently finds libfcgi.a, but yet it fails to link to the...
I'm working with a listview control which saves the data using AES encryption to a file. I need to keep the data of every item in listview in std::list class of std::string. should I just keep the data encrypted in std::list and decrypt to a local variable when its needed? or is it enough to keep it encrypted in file only?
...
Hi,
I am drawing a rectangular block:
GLfloat cubeVertexV[] = {
// FRONT
-0.5f, -1.0f, 0.5f,
0.5f, -1.0f, 0.5f,
-0.5f, 1.0f, 0.5f,
0.5f, 1.0f, 0.5f,
// BACK
-0.5f, -1.0f, -0.5f,
0.5f, -1.0f, -0.5f,
-0.5f, 1.0f, -0.5f,
0.5f, 1.0f, -0.5f,
// LEFT
-0.5f, -1.0f, 0.5f,
-0....
I created main dialog and call no modal dialog, how can i check in main dialog that button is clicked in no modal?
For example if i call modal i can check like this:
Dialog Dlg;
int DlgResult = static_cast<int>(Dlg.DoModal());
if (DlgResult== IDOK)
{
//do smth.
}
...
Hi,
I have quite massive program (>10k lines of C++ code). It works perfectly in debug mode or in release mode when launched from within Visual Studio, but the release mode binary usually crashes when launched manually from the command line (not always!!!).
The line with delete causes the crash:
bool Save(const short* data, unsigned i...
I have a C++ class(inside a dll project) whose member variables are boost::shared_ptrs to objects of other classes. Is it better to assign them inside the class constructor or have a separate init() function which does that.
I am assuming the default value of pointer to T inside boost::shared_ptr is NULL. So if I do nothing inside the ...
Hello
I have some projects which were done in c++ builder 2009 and they need borlandmm.dll to run. I have read that c++ Builder 2010 by default use Fastmm, but it dont seems to be the case in my projects. They still need borlandmm.dll
So how can i switch my projects to use fastmm ?
Regards
James
...
How to convert an ASCII std::string to an UTF8 (Unicode) std::string in C++?
...
If I do this:
// (1.)
int* p = new int;
//...do something
delete p;
// (2.)
class sample
{
public:
sample(){}
~sample(){}
};
sample* pObj = new sample;
//...do something
delete pObj;
Then how does C++ compiler know that object following delete is built-in data type or a class object?
My other question is that if I new a pointer to an...
I have several elements in a vector type that are read from cin and then i perfrom some calculations on the vector and it's order of elements gets changed. The problem is that I need to print the positions of the vector elements after the calculations. I don't know how to explain this well that's why i'll give an example:
10 1 100 1000
...
Hi
I am reading effective C++ in Item 5, it mentioned two cases in which I must define the copy assignment operator myself. The case is a class which contain const and reference members.
I am writing to ask what's the general rule or case in which I must define my own copy constructor and assignment operator?
I would also like to kno...
std::cout << "blblabla... [done]" << std::endl;
Is it possible to make [done] be in another color, and possibly bold? I'm using Windows 7
...
I would like to purchase a copy of Effective C++, but I've hit on in issue. The first edition goes for about $4 used on Amazon, which is awesome. The second edition is about ten times as much. Could someone please give me some advice as to what I'm be missing out on if I bought the older edition?
In other words, is the first edition st...
Hi everyone !
I'm trying to draw a line using GLUT with C++ - the IDE is VS 2008 -but an error message occurred :
Windows has triggered a breakpoint in
Graphics.exe.
This may be due to a corruption of the
heap, which indicates a bug in
Graphics.exe or any of the DLLs it has
loaded.
This may also be due to the user
...
Hi,
Sorry if this is a dupe, I cant find an answer quite right.
I want to call a function from a base class member, and have it resolve to the subclass version. I thought declaring it virtual would do it, but it isn't. Here's my approach:
class GUIWindow
{
public:
GUIWindow()
{
SetupCallbacks();
}
virtual void...
The Loki library implements some very widely used concepts (smart pointer, visitor, factory, etc.). The associated book "Modern C++ Design" is often mentioned, but the library itself is not widely used. Why is that?
Most developers seem to prefer Boost. In particular, why do people often decide to use Boost's smart pointers rather than ...