While trying to answer this question I found that the code int* p = new int[10](); compiles fine with VC9 compiler and initializes the integers to 0. So my questions are:
First of all is this valid C++ or is
it a microsoft extension?
Is it guaranteed to initialize all
the elements of the array?
Also, is there any difference if I
do new...
Glib::ustring is supposed to work well with UTF8 but I have a problem when working with Japanese strings.
If you compare those two strings, "わたし" and "ワタシ", using == operator or compare method, it will answer that those two strings are equals.
I don't understand why. How Glib::ustring works ?
The only way I found to get false to the c...
Hi,
I want to read mails using LNDocument.
Can someone provide me sample codes.
Regards,
Jene
...
Hi,
This is a question about installing driver.
I have the following files :
aaa.cat
aaa.inf
x86\ttt.sys
I can install this driver by clicking "update driver" in device manager.
But now I need to install this driver on Windows (XP, Vista and Win7) by using C++.
How could I do this?
On the other hand, I can't use install shield or oth...
Is there some magic required to obtain a "zlib sync flush" when using boost::iostreams::zlib_compressor ? Just invoking flush on the filter, or strict_sync on a filtering_ostream containing it doesn't see to do the job (ie I want the compressor to flush enough that the decompressor can recover all the bytes consumed by the compressor so...
I have an NSImage pointer from a platform SDK, and I need to load it into Qt's QImage class. To make things easier, I can create a QImage from a CGImageRef by using QPixmap as an intermediate format, like this:
CGImageRef myImage = // ... get a CGImageRef somehow.
QImage img = QPixmap::fromMacCGImageRef(myImage).toImage();
However, I ...
AFAIK, freeing a NULL pointer will result in nothing. I mean nothing is being done by the function free.
Still, I do see some statements where people say that one of the scenarios where memory corruption can occur is "freeing memory twice".
Is this still true?
...
Are the "modify" operators like +=, |=, &= etc atomic?
I know ++ is atomic (if you perform x++; in two different threads "simultaneously", you will always end up with x increased by 2, as opposed to x=x+1 with optimization switched off.)
What I wonder is whether variable |= constant, and the likes are thread-safe or do I have to protec...
I w'd really appreciate if somebody suggest me any book which has good interview questions on C++, STL and boost?
...
class A
{
public:
A()
{
}
};
class B : public A
{
public:
B()
{
}
};
int main()
{
A *a=new A();
B * b=static_cast<B*>(a);
}
...
Hello, I have a class A containing two pointers to objects of another class B. I want to initialize one pointer or the other depending on which one is passed to init(), which also takes other parameters. My situation is thus the following:
class A {
public:
A();
init(int parameter, int otherParameter, B* toBeInitialized);
prot...
Hi there,
I need to read a textfile and store the data into a Safearray.
I tried it with this function:
bool Parse::LoadTxtFileIntoSafearray(string* strPath, SAFEARRAY** pByteArray)
{
bool bReturn = false;
string line;
int iOffset = 0;
char* pcBuffer = NULL;
std::ifstream infile ( strPath->data() );
if ( !infile.fail() )
{
infil...
This very simple code:
#include <iostream>
using namespace std;
void exec(char* option)
{
cout << "option is " << option << endl;
if (option == "foo")
cout << "option foo";
else if (option == "bar")
cout << "opzion bar";
else
cout << "???";
cout << endl;
}
int main()
{
char opt[] = "foo...
Hello,
I'm working on a C++ project that produces a lib that other teams use. It's being produced in a few different flavours:
Win32 Debug Dynamic
Win32 Debug Static
Win32 Release Dynamic
Win32 Release Static
x64 Debug Dynamic
x64 Debug Static
x64 Release Dynamic
x64 Release Static
I'm wondering what the best wisdom is on how to nam...
I want to download all file from ftp directory i want use for that FtpFindFirstFile and FtpGetFile;
LPWIN32_FIND_DATA FileData;
TCHAR* APP_NAME = TEXT("ftpcli");
TCHAR* PATH_FTP = TEXT("ftp://127.0.01");
TCHAR* ADR_FTP = TEXT("127.0.0.1");
TCHAR* LC_FILE = TEXT("C:\\!");
TCHAR* PATH_FILE = TEXT("/Soft/DVD_Players/WinDVD6");
UINT a;
HI...
For some graphics work I need to read in a large amount of data as quickly as possible and would ideally like to directly read and write the data structures to disk. Basically I have a load of 3d models in various file formats which take too long to load so I want to write them out in their "prepared" format as a cache that will load muc...
I have a C++ app that uses large arrays of data, and have noticed while testing that it is running out of memory, while there is still plenty of memory available. I have reduced the code to a sample test case as follows;
void MemTest()
{
size_t Size = 500*1024*1024; // 512mb
if (Size > _HEAP_MAXREQ)
TRACE("Invalid S...
I've written an assembler function to speed up a few things for image processing (images are created with CreateDIBSection).
For Win32 the assembler code works without problems, but for Win64 I get a crash as soon as I try to access my array data.
I put the relevant info in a struct and my assembler function gets a pointer to this stru...
I'm using Boost.Spirit which was distributed with Boost-1.42.0 with VS2005. My problem is like this.
I've this string which was delimted with commas. The first 3 fields of it are strings and rest are numbers. like this.
String1,String2,String3,12.0,12.1,13.0,13.1,12.4
My rule is like this
qi::rule<string::iterator, qi::skip_type> st...
I am having problems here if I want to check if eerste points to nothing I get
Blockquote
Unhandled exception at 0x003921c6 in
Bank.exe: 0xC0000005: Access violation
reading location 0xccccccd0.
and I am kinda wondering why he justs skips the if statement or doens't stop when the object eerste points to nothing
Bank::Ban...