c++

Invalid character string partly recognized? c++

BLUF: In this function, \' prompt the error message but not \?, Why? char key[] = "\a\b\f\n\r\t\v\\\'\"#%&*;:<>\?/{|}~"; if (strpbrk(*local_str, key) != NULL ) { vico_param_out->out_valid = false; AfxMessageBox("L'identifiant de numérisation est invalide. Vous avez saisi des caractères qui ne peuv...

Impersonation in asp.net not shared with com object.

So I have an ASP DOT NET web service which needs to impersonate Windows Authenticated users. This web service calls into a Com Api to perform database operations. It seems like the Impersonation does not persist into the Com Api. Is this because the Com DLL is loaded into its own memory space and treated as a separate process? Also what...

Align a GtkLabel relative to a GtkDrawingArea

I have a GtkLabel and a GtkDrawingArea within a VBox, I want to center the label relative to a X-coordinate of the GtkDrawingArea (which is below of the label in the VBox), how can I tell GTK to center that label relative to that "anchor" point ? This point should be the center of the label. ...

Should a C++ embedded application use a common header with typedefs for built-in C++ types?

It's common practice where I work to avoid directly using built-in types and instead include a standardtypes.h that has items like: // \Common\standardtypes.h typedef double Float64_T; typedef int SInt32_T; Almost all components and source files become dependent on this header, but some people argue that it'...

Cannot unlock Mutex

Note: I am using the open source Poco C++ libraries I have a parent thread that creates many child threads to deal with incoming connections, each of these child threads maintains an XML document, which the parent thread can request at anytime via callback. Therefore I have a mutex protecting this document. My problem arises in tha...

Why I'm allowed to assign a new address to a vector containing constant pointers?

Hi, I think the title is clear on explaining my problem.... consider the following snippet: class Critter { int m_Age; }; int main() { vector<Critter* const> critters; for(int i = 0; i < 10; ++i) critters.push_back(new Critter()); critters[2] = new Critter(); return 0; } Shouldn't the line critters[2] =...

What is the preferred way to check for a Null pointer in C++?

Options A: if (NULL == pSomethingColumn) // Yes, we use Yoda conditions if (NULL != pSomethingColumn) Or if (pSomethingColumn) if (!pSomethingColumn) I am looking for references explaining the reasoning as well. I have heard some people say that technically NULL does not have to be defined as 0, but come on! if that was the case, ...

[C++] covariant return types

Hi, I have a VectorN class, and a Vector3 class inherited from VectorN (which can handle cross products for example). I have trouble determining the return types of the different operators. Example: class VectorN { public: VectorN(){}; virtual VectorN operator*(const double& d) {.....}; std::vector<double> coords; }; class Vec...

How to get a float from a char* in C++?

I am relatively new to C++, coming from the happy-go-lucky world of Python. I decided to write a set of functions to find the mean, median, mode, and range of a set of numbers. To aid in the calculation of the median, I decided to make l2g (least to greatest) and g2l (greatest to least). I understand I will only be using one of these, b...

does anyone have more info on standard in and standard out?

I don't have much of an interest in designing guis (too much work), and I wanna know how it is that programs like vim, and greed work, how is it that vim can modify it's standard out without printing it all out again?, and I often see the output from terminal programs in bright colors, is there some sort of markup language that tells the...

Variadic Macro with 3 terms

I am trying to understand a c++ code that reads a dll explicitly. Does any one know how the line "#define LFE_API(name) LFE_##name name" bellow actually works? I understand "#define LFE_API(name) LFE_##name" but get confused about the last "name". struct Interface { # ifdef LFE_API # error You can't define LFE_API be...

Question about libc_write()

I'm trying to determine what libc_write does exactly. I'm executing a binary on a processor simulator I designed in c++ and the program being run has jumped to the function call libc_write(). Now, there are 2 different types of write functions - write() which writes one large buffer to a stream, possibly comprised of many buffers that ...

Windows Vista+ Memory Problem with IFileOpenDialog and large stack

I have experienced a strange problem in windows vista and above. When I use the IFileOpenDialog with a large stack, the amount of memory remaining after showing the dialog drops by about a gigabyte. #include <windows.h> #include <Shobjidl.h> #include <iostream> void memGrab(char *); int main(int argc, char **argv){ char Message[128];...

How to reduce the size of Windows Mobile Date-Time Picker Control?

Hello, everyone. I ran into another problem a few days ago that I can't figure out. I am working with two mobile devices: TouchPro2, with Windows Mobile 6.1 Professional, and TouchPro2 with Windows Mobile 6.5 Professional. So, the hardware is the same, only the version of Window Mobile is different, and even then it's just a different b...

How to check if a datatype is "defined" with typedef

I faced this problem today and just wondering how to check if a new type defined with typedef is really defined somewhere. To give an example, I started using Xerces-c3 library that I built from source code and wrote a xml2text converter. But I couldnt find Xerces-c3 port on fbsd so installed Xerces-c2 library. When I tried to recompil...

Is it reasonable for a programmer to create a C# wrapper for video transcoding?

What can a programmer (one person) get from providing the community with opensourse (more or less) video transcoding library\wrapper? (I know we have Tao but it is not good for 2010...) I think of video transcoder based on FFMpeg. simple wraper which would simplify FFmpeg bringing to C# such functions like ReadFrame(bytearray, framenum...

Linking libraries to a QT project using pkg-config output

This is a bit of a newbie question. I am trying to add the OpenCV libraries to a QT project. This question says the link flags are given by pkg-config --libs opencv If I paste the command line output into the project file like: LIBS += -L/usr/local/lib -lml -lcvaux -lhighgui -lcv -lcxcore then everything compiles fine, but now thi...

What is wrong with using goto?

Possible Duplicates: Why is it bad to use goto? GOTO still considered harmful? I was ramdomming through xkcd and saw this one (if also read some negative texts about them some years ago): What is actually wrong with it? Why are goto's even possible in C++ then? Why should I not use them? ...

Is there a C++ container with reasonable random access that never calls the element type's copy constructor?

I need a container that implements the following API (and need not implement anything else): class C<T> { C(); T& operator[](int); // must have reasonably sane time constant // expand the container by default constructing elements in place. void resize(int); // only way anything is added. void clear(); C<T>::iterator be...

How to pass string array as BSTR* to web service proxy

In VS2005 I have generated a web reference to a web service that takes a 1-dimensional array of strings ("inputArray") as an input parameter. The proxy function generated for this web service call asks for two parameters: BSTR *inputArray int inputArray_nSizeIs What is the proper syntax for passing in inputArray as a BSTR*? Currentl...