c++

How to program a super simple software activation system?

Hi, I have a piece of shareware that I wrote that I'd like to distribute on the internet. I have a serial number type thing set up but there is still a ton of key sharing :(. I'd like to add a system where once the user enters the serial, it is checked with my server to make sure that it is valid. Simplicity is key. -Client sends MD5 o...

How to get started with directshow ?

I'm having a great trouble trying to understand this, what's the least set up to compile/run directshow apps? I've already installed visual c++ 2008 express. A hello world will be nice, RGS! ...

Compile-time assertions in C++?

I recently came upon the need to have compile-time assertions in C++ to check that the sizes of two types were equal. I found the following macro on the web (stated to have come from the Linux kernel): #define X_ASSERT(condition) ((void)sizeof(char[1 - 2*!!(condition)])) which I used like so: X_ASSERT(sizeof(Botan::byte) != sizeof(c...

Sending variable pointers back and forth between C++ and Lua?

I am looking for a way to transfer the variable addresses back and forth between C++ and Lua. For instance, transferring an object from C++ to Lua and do some processing, then transfer it back to C++. However, the thing is how can you execute a C++ functions or methods from Lua? Or is a workaround required? If possible, could you incl...

counting the number of lines in a text file.

hey there, I'm reading lines off of text file and I'm wondering if this is a good way to go?. I had to write the function numberoflines to decrease the number_of_lines variable by one because within the while loop, for every line it read it adds 2 to the number_of_lines variable. #include <iostream> #include <fstream> using namespace st...

C++ Screen Scraping from HTML

Hi guys, i'm trying to extract the data "Lady Gaga Fame Monster" from the html below using substr and find, but i wasn't able to retrieve the data. <div class="album-name"><strong>Album</strong> > Lady Gaga Fame Monster</div> I'm tried to extract the whole string first, but i can only extract till Album under the command cout << line...

How do you read the 128-bit NTFS FILE_ID for a directory and/or file?

So NTFS uses a 128-bit Guid to identify files and directories, you can view this information easily enough: C:\Temp>C:\Windows\System32\fsutil.exe objectid query . Object ID : ab3ffba83c67df118130e0cb4e9d4076 BirthVolume ID : ca38ec6abfe0ca4baa9b54a543fdd84f BirthObjectId ID : ab3ffba83c67df118130e0cb4e9d4076 Domain ID : ...

What's the principle of blocking mode?

Like blocks until the file is done playing, what's the principle and how to implement this? ...

What does the '&' means in a Unary Operator of a Class?

class CDate { // some declarations public: CDate& operator ++ () { // increment function; return *this; } }; Does the '&' mean a reference that is being a return? Thanks SpecC ...

Need some feedback on how to make a class "thread-safe".

I'm currently learning how to do multithreading in C++. One of my learning projects is a Tetris game. In this project I have a Game class that contains all game state data. It has methods for moving the block around and a few other things. This object will be accessed by the user (who will use the arrow keys to move the block, from the m...

How to debug to assembly level with visual studio express?

I'm curious about how some features are implemented under the hood,like : pEvent->WaitForCompletion(INFINITE, &evCode); I tried to step into it but failed. Is there a way to do that? ...

How to understand .def files?

LIBRARY Vcam.ax EXPORTS DllMain PRIVATE DllGetClassObject PRIVATE DllCanUnloadNow PRIVATE DllRegisterServer PRIVATE DllUnregisterServer PRIVATE The above is from Filters.def, what does it actually do? ...

fatal error C1083: Cannot open include file: 'boost/config.hpp': No such file or directory

I think I did all the necessary configuration but I am still getting this: Error 1 fatal error C1083: Cannot open include file: 'boost/config.hpp': No such file or directory File:c:\documents and settings\administrator\my documents\visual studio 2008\libs\boost_1_43_0\boost\smart_ptr\shared_ptr.hpp Line:17 Here are screenshots of s...

How to access multiple levels of overridden elements?

How do I access overridden members of base classes of base classes? #include <iostream> using namespace std; class A {public: char x; A(){x='A';};}; class B1 : public A {public: char x; B1(){x='B';};}; class B2 : public A {public: char x; B2(){x='B';};}; class C : public B1, public B2 {public: char x; C(){x='C';};}; int main(){ C ...

QFile open file for writing fails

I'm trying to open file and write some text data into it. QFile out(":/test.txt"); if (!out.open(QIODevice::ReadWrite)) { QMessageBox msgBox; msgBox.setText(out.errorString()); msgBox.exec(); return; } But it fails with "Unknown error". (Qt 4.6, Wnidows XP SP3) ...

detecting memory leaks in C++ / windows

For debugging purposes, when I'm writing an app, the first thing I do is put the following into the stdafx.h: // -- leak detection ---------------------------------------------------------- #ifdef _DEBUG // http://msdn.microsoft.com/en-us/library/e5ewb1h3(v=VS.80).aspx #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg...

How to get your head around C++ linking/dependencies?

I'm a Java developer and I never have to worry about including files or messing with BUILD files. Whenever I need to write C++ code, things get more complicated. I can think of creating *.h files as interfaces in Java, but figuring out how to write the build file and what order classes should be included in gives me a headache. Is the...

How do you `realloc` in C++?

Any ideas how to realloc in C++? It seems to be the missing language language - there is new and delete but not resize! I need it because as my program reads more data, I need to reallocate the buffer to hold it. I don't think deleteing the old pointer and newing a new, bigger one, is the right option. Please enlighten me. Thanks, B...

How to compile bada gcc toolchain from command line?

Hello I want to develop a helloworld application but want to compile it using Command line not by BADA IDE.Could any body help me with it. Thanks ...

What is the right way to put a smart pointer in class data (as class member) in C++?

Suppose I have a class Boda: class Boda { ... }; And I have a member cydo in this class that I want to be a smart pointer (that is, I want it to get deallocated automatically as soon as the class gets destroyed). I am using Boost's smart pointers, so I write: class Boda { boost::shared_ptr<int> cydo; public: Boda...