why i'm getting the memory leak errors without allocating or adding any elements to list below. should i just ignore it?
#define CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#include <list>
using std::list;
int main()
{
list <char*> roots;
_CrtDumpMemoryLeaks();
}
...
I know that Visual Studio under debugging options will fill memory with a known value.
Does g++ (any version, but gcc 4.1.2 is most interesting) have any options that would
fill an uninitialized local POD structure with recognizable values?
struct something{ int a; int b; };
void foo() {
something uninitialized;
bar(uninitialize...
I want to write something like 2d strings in C++.
I tried with :
vector< vector<string> > table;
int m,n,i,j;
string s;
cin>>n>>m;
for(i=0;i<n;i++) {
for(j=0;j<m;j++) {
cin>>s;
table[i][j] = s;
}
}
cout << "\n...
I'm working on a C++ application to read some data from an Excel file. I've got it working, but I'm confused about one part. Here's the code (simplified to read only the first cell).
//Mostly copied from http://www.codeproject.com/KB/wtl/WTLExcel.aspx
#import "c:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSO.DLL"
#import "c:...
I have a compressed string written by PHP gzcompress($string)
I need to read it with C++ on QT.
Any help is very appreciated!
...
Possible Duplicate:
C++: How to split a string?
Is there a way to tokenize a string in C++ with multiple separators? In C# I would have done:
string[] tokens = "adsl, dkks; dk".Split(new [] { ",", " ", ";" }, StringSplitOptions.RemoveEmpty);
...
Is there a way to know whether a variable is defined, by looking at the executable.
Lets say I declare
int i;
in the main function. By compiling and linking I get an executable my_program.exe.
Now, by looking inside my_program.exe, can I say if it has an int eger variable i ?
...
In a book I am reading there is a piece of code :
string x;
size_t h=0;
for(const char* s=x.c_str();*s;++s)
h=(h*17)^*s;
Regarding this code, I have two questions:
how can *s be a condition? what does it mean?
what does "h=(h*17)^*s" mean?
Thanks for help!
...
EDIT: I know in this case, if it were an actual class i would be better off not putting the string on the heap. However, this is just a sample code to make sure i understand the theory. The actual code is going to be a red black tree, with all the nodes stored on the heap.
I want to make sure i have these basic ideas correct before mov...
In my algorithm i need create information output. I must to write boolean matrix in bmp file.
It must be monocromic image, where pixel is white if matrix on such element is true.
Main problem is bmp header and how to write this.
Thanks.
...
I'm trying to write a Windows console application (in C++ compiled using g++) that will execute a series of instructions in a loop until finished OR until ctrl-z (or some other keystroke) is pressed. The code I'm currently using to catch it isn't working (otherwise I wouldn't be asking, right?):
if(kbhit() && getc(stdin) == 26)
//The...
I have a class defined called extBlock.
I then make an instance of that class with this
extBlock mainBlock = new extBlock(1, 1024);
I get this error:
error C2440: 'initializing' : cannot convert from 'extBlock *' to 'extBlock'
Can anyone help me with why I am getting this error.
I have seen examples online of declaring it like th...
I'm trying to use a Boost MultiIndex container in my simulation. My knowledge of C++ syntax is very weak, and I'm concerned I'm not properly removing an element from the container or deleting it from memory. I also need to modify elements, and I was hoping to confirm the syntax and basic philosophy here too.
// main.cpp
...
#include <bo...
I'm trying to testing a concrete object with this sort of structure.
class Database {
public:
Database(Server server) : server_(server) {}
int Query(const char* expression) {
server_.Connect();
return server_.ExecuteQuery();
}
private:
Server server_;
};
i.e. it has no virtual functions, let alone a well-defined int...
I want to make a function in C that can return PI to X places..
I'm just not sure how...
Thanks
Edit: I don't care how slow it is I really just want an algorithm that will return PI at X decimal... Iv been looking at http://bellard.org/pi/ but I don't understand how to get the nth of Pi from this. Thanks
...
How can I get an equivalent of java.lang.Integer.MIN_VALUE on C++?
...
Here is my simple multidimensional array program. The first error occurs where I declare the function addmatrices and then a second one where it is implemented. I am also getting an undefined variable error for bsize.
What am I doing incorrectly?
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespa...
Hello, I'm a newbie with Boost::Python but I tried to search on the web to do so
I want to expose a 3rd party library to Python. One of the class of the library (.hpp) is composed of
a public constructor with arguments
a protected constructor and functions
various regular functions
various pure virtual functions
various non pure virt...
I am having an issue with my HTTP requests in my app, such that if the remote file is the same size as the local file (even though its modified time is different, as its contents have been changed), attempts to download it return quickly and the newer file is not downloaded.
In short, the process I am following is: Setting up an HTTP co...
I need my program to create and edit a config file, which would contain information about set of objects, and than read it at every execution. Is there some sort of guideline for config style that i can use?
I'm using C++ on windows.
...