c++

Old issues of "C++ Report"?

Hi, I used to receive "C++ Report" magazine (along with "C/C++ User's Journal"), both now defunct. For the longest time, I would cart around the issues, from move to move. Regrettably, a few years ago I decided to stop carting them around & I recycled them. There was a lot of wisdom in those pages, and now I find myself wishing I co...

Is there a way to simulate Windows input with C++?

I'm wondering if its possible to make a program in C++ that can "press" keys, or make the computer think certain keys have been pressed, and do things like make a program that "plays" games, or automatically enter some long and obscure button sequence that no one could remember. (I can't think of any right now, but savegame passwords mi...

C++ SFINAE examples?

I want to get into more template meta-programming. I know that SFINAE stands for "substitution failure is not an error." But can someone show me a good use for SFINAE? ...

Shifting from .NET to Win32 development

I have been a .NET developer since I started coding. I would like to learn Win32 programming. Need advice on where to start. What are the best resources /books for learining Win32 programming. I know a bit 'college C++'. ...

How to traverse a windows explorer like tree structure

Hello All. I am working on designing a FTP client and need some help with designing a feature which its sole purpose is to be able to traverse a tree like structure and upload the folders and files which have been selected by the user. So essentially the user can select multiple folders and files at one time from the local file and fol...

Strange code error

This is regarding the problem which I posted earlier today. I made the program to identify and print the digits of a given number. The program runs fine when I use 1, 2, 4 digits (I made 4 max), but when I input a 3-digit number, it prints the numbers wrong and ends abruptly. Help me out.. #include <stdio.h> #include <stdlib.h> #includ...

Is there any overhead to declaring a variable within a loop? (C++)

I am just wondering if there would be any loss of speed or efficiency if you did something like this: int i = 0; while(i < 100) { int var = 4; i++; } which declares int var one hundred times. It seems to me like there would be, but I'm not sure. would it be more practical/faster to do this instead: int i = 0; int var; while(...

Is this deallocation correct? (c++)

Hello, I've a 3x3 2D dynamic array allocated as below int** matrix = new int* [3]; matrix[0] = new int [3*3]; for (int i = 1; i < 3; ++i) matrix[i] = matrix[i-1] + 3; How should I deallocate it? Is it correct: delete [] matrix; delete [] matrix[0]; Or should I also delete matrix[1], [2] Greetings, ...

Is Interlocked enough for this situation ?

I have a multithreaded application (C++) where I need to increment/change a series of values. If I use a series of Interlocked operations, are they considered to be a single atomic operation ? Like in this example: InterlockedIncrement(&value1); InterlockedIncrement(&value2); InterlockedExchange(&oldValue, newValue); Or it would be be...

Help with std::find

What exactly must I replace ??? with to get the iterator (it) to some element (for example Base(2)) ? I tried a few shots but nothing, compiler just says that it is wrong. Here is code #include <cstdlib> #include <iostream> #include <vector> using namespace std; class Base { public: Base(int a) {ina = a;} ~Base() {} ...

Calling a method from another method in the same class in C++

I wrote a method (that works fine) for a() in a class. I want to write another method in that class that calls the first method so: void A::a() { do_stuff; } void A::b() { a(); do_stuff; } I suppose I could just rewrite b() so b(A obj) but I don't want to. In java can you do something like this.a(). I want to do obj.b() wher...

recursive folder scanning in c++

Hi I want to scan a directory tree and list all files and folders inside each directory. I created a program that downloads images from a webcamera and saves them locally. This program creates a filetree based on the time the picture is downloaded. I now want to scan these folders and upload the images to a webserver but I´m not sure how...

Create a GUI from a XML-Schema automatically

I have to write a desktop application to edit data stored in a XML File. The Format is defined by a XML Schema File (.xsd). The Format is quite complex. Are there tools which can generate a basic gui automatically? It's not yet decided which language to use. I have experience in Python and C++ using wxWidgets and C# (.Net1) using Windows...

C++ formatted input: how to 'skip' tokens?

Hi all! Suppose I have an input file in this format: VAL1 VAL2 VAL3 VAL1 VAL2 VAL3 I'm writing a program that would be interested only in VAL1 and VAL3. In C, if i wanted to 'skip' the second value, I'd do as follows: char VAL1[LENGTH]; char VAL3[LENGTH]; FILE * input_file; fscanf(input_file, "%s %*s %s", VAL1, VAL3); Meaning, I'd...

MFC programming in c++

Hi there, I am new to this MFC stuff, I am working on a project, where i need to use class CFileFind which is in MFC. how can I link to my regular VC++ program to use that class. I am completely new to MFC, n apologize if there is a mistake. thanks in advance. ...

C++ - Convert FILE* to CHAR*

I found a C++ source file which calculates expressions from a command line argument (argv[1]), however I now want to change it to read a file. double Utvardering(char* s) { srcPos = s; searchToken(); return PlusMinus(); } int main(int argc, char* argv[]) { if (argc > 1) { FILE* fFile = fopen(argv[1], "r"); double Value = Utvard...

Fully Featured C++ Assert Dialog?

Hi, I'm looking for a good, fully featured C++ assert macro for VisualStudio. With features like be able to ignore an assert once or always, to be able to break exactly where the macro gets called (and not inside macro code), and getting a stack trace. Before I have to hunker down and write one, I figured I'd ask if anyone knows about ...

I have an unintended delay in playing a Mix_Chunk

So I am trying to learn SDL and creating a small game. When the user presses the space bar, it should play a sound. This works, but the sound takes about .5 seconds to play... How would I fix this? I've checked the actual file to see if the delay was just part of it, and that turned out to not be the case. SDL with c++ on win vista. He...

Simple 3x3 matrix inverse code (C++)

What's the easiest way to compute a 3x3 matrix inverse? I'm just looking for a short code snippet that'll do the trick for non-singular matrices, possibly using Cramer's rule. It doesn't need to be highly optimized. I'd prefer simplicity over speed. I'd rather not link in additional libraries. Primarily I was hoping to have this on Sta...

Returning STL lists as argument

I have a function that reads lines from a log file, converts these lines to a certain class and returns a STL list of instances of this class. My question is: how should I declare this function so that the whole list is NOT copied when attributing it to the caller? Without loss of generality, assume: list<Request> requests = log_manipu...