c++

Encryption of Objects stored to disk using C++ (for a Java Developer)

Hi All, This is two questions in one but hopefully trivial to a C++ developer. How can I seralize an object so that I can write it to disk and retrieve it later in C++ or if this is the wrong keyword how can I write an object as a binary stream and recreate it later? Can I use inheritance to make a hierarchy of classes serializable? w...

How does a CRichEditCtrl know a paste operation has been performed?

It has methods like CRichEditCtrl::Copy(), CRichEditCtrl::Paste() which you can call, but I can't spot any messages the control is sent by Windows telling it to perform a paste operation. Does anyone know if such a thing exists? Or does CRichEditCtrl do something lower-level like monitoring WM_CHAR events? If so can I reuse any internal ...

function to return the windows installed drive ?

i would like to know the function which returns the drive where the windows has been installed. for example if we run a program with following code in windows which is installed in "C:\" temp_char = getWindowsInstalledDrive(); should return "C:\". please point me to that function if you know. it should be a C/C++ function. Thanks...

use class and enum with same name?

I've a class and an enum value which have the same name. Inside the class I want to use the enum which gives an error. Is there any way to use the enum without renaming or moving to a different namespace? Example: namespace foo { enum bar { BAD }; class BAD { void worse () { bar b = BAD; // erro...

MSVC Object Layout Quirk

I have a simple class in C++ that has an integer and a vtable: class Something { virtual void sampleVirtualMethod(); int someInteger; }; If you look at the object layout for MSVC (using the /d1reportSingleClassLayout) you get: class Something size(8): +--- 0 | {vfptr} 4 | someInteger +--- W...

What's the correct way to create a subclass of a MFC control?

We layout dialogs using the resource editor. So say I have a RichEditCtrl called IDC_RICH. And I want to link it to an instance of a custom class CMyRichEditCtrl : CRichEditCtrl, without losing the ability to set properties on it in resource editor. What's the right way? You can certainly get some functionality by creating a DDX-linked ...

Visual Studio as Code Browser : How to preserve the directory structure?

Hello, I've downloaded source of an opensource C++ project. It is a Linux project. As Visual Studio is my favorite IDE I want to use it to browse & study the code. I created an empty C++ project and now want to add the source code to Solution explorer. How can I add the directory structure to "Solution Explorer". Dropping the root fol...

is there a function like getdelim is c++?

Hi, Is there a function in c++ that works like the getdelim function in c? I want to process a file using std::ifstream object, so I cannot use getdelim here. Any help would be much appreciated. Thanks. ...

How to improve Visual C++ compilation times?

I am compiling 2 C++ projects in a buildbot, on each commit. Both are around 1000 files, one is 100 kloc, the other 170 kloc. Compilation times are very different from gcc (4.4) to Visual C++ (2008). Visual C++ compilations for one project take in the 20 minutes. They cannot take advantage of the multiple cores because a project depend ...

Boost.ASIO-based HTTP client library (like libcurl)

I am looking for a modern C++ HTTP library because libcurl's shortcomings are difficult to work around by C++ wrappers. Solutions based on Boost.ASIO, which has become the de-facto C++ TCP library, are preferred. ...

How can I use templated typedefs, that are _in_ a class, from outside the class (e.g. by another class), in relation to boost::graph

Hi, I found a very useful answer on how to create templated graphs using boost::graph under http://stackoverflow.com/questions/671714/modifying-vertex-properties-in-a-boostgraph/950173#950173 For me, this is very convenient as long as I do all the work on the graph in the Graph-class itself. However, it might be necessary to access in...

checking for eof in string::getline

Hi, how do I check for end-of-file using the string::getline function? Coz, using .eof() is not recommended as it wont signal eof until I attempt to read beyond eof. ...

How to run .exe binary of a remote server on the remote server from a c++ application in windows platform

What are the ways to run .exe binary of a remote server on the remote server from a c++ application in windows platform?? ...

Problem inheriting member functions with similar signatures in C++

I have an MFC C++ program that contains two classes, as follows; struct MyStruct { ' ' }; class Class1 { public: virtual MyStruct *MyFunc(LPCTSTR x); virtual void MyFunc(MyStruct *x); ' ' }; class Class2 : public Class1 { public: virtual void MyFunc(MyStruct *x); ' ' }; main() { ' ' CString Str = _T("WTF"); Class2 a; ...

linux - detecting change of system time

Is there a way to get notified when there is update to the system time from a time-server or due to DST change? I am after an API/system call or equivalent. It is part or my effort to optimize generating a value for something similar to SQL NOW() to an hour granularity, without using SQL. ...

error C2146: syntax error : missing ';' before identifier

i can't get rid of these errors... i have semicolons everywhere i checked... the code is simple: the error takes me to the definition "string name" in article.h... main.cpp #include <iostream> #include <fstream> #include <vector> #include <string> using namespace std; #include "article.h" int main() { string si; char article[128];...

program that will compile in C but not in c++

this question was asked to my friend in an interview. "can you write any program that will compile in C but not in C++". is there any such program? ...

In which memory area are exception classes instances created ?

I could not find the information where are exception class instances created during exception handling ? In which memory area (stack, heap, static storage, etc.) ? I assume it is not on the stack because of stack-unwinding ... ...

why we use any value in exit function in loop in c language

In C/C++ language loop statements we use exit(0), or exit(1) or other values. What is needed of that value, what is the role of that value in a loop when we exit the loop, and what is the meaning of 1 and 0 in exit()? ...

Linker error: Unresolved external '__Fastcall_Advgrid::TAdvstringGrid::AutosizeCol......referenced from ...name.OBJ

Hello, I was compiling a project, and this project has a unit called Gamespaceframe, the header file was as follow: : #include "Advdgrid.hpp" : and the .cpp was as follow: : #Pragma link "Advdgrid" : When I recompiled this project, I got this linker error: Linker error: Unresolved external '__Fastcall_Advgrid::TAdvstringGrid::...