c++

MFC Get Folders

Hey how do I in MFC get names of all folders? Any examples or which classes should I look into? Any hints will be really appreciated. All I saw is the CFile, which as far as I have seen (though very very little) doesn't looks like it has the ability to do what I want. So please direct me. Thanks ...

Access Violation Reading Location on std::set::erase

I have recently caught the following crash in my application: m_players[0].erase(plr); -- CRASHES HERE m_players[1].erase(plr); m_players is declared as: set<PlayerPointer> m_players[2]; Visual Studio shows that it is "0xC0000005: Access violation writing location 0x0000000000000024." Compiler: Visual Studio 2008. Diassembly: 00...

Generating and saving code from Macro

I am analyzing a legacy code which heavily using macro , I am lost in understanding how macro are expanding in code. Could any one suggest me some tool or technique so that i can study actual code generated from macro expansion. Platform : Windows XP Language : C++ Compiler : VC6 Thanks in Advance ...

Open file in TagLib with Unicode chars in filename

Hello, I am quite new to the C++ 'area' so I hope this will not be just another silly 'C++ strings' question. Here is my problem. I want to integrate TagLib (1.5, 1.6 as soon as I manage to build it for Windows) into an existing Windows MFC VS2005 project. I need it to read audio files metadata (not write). The problem is that the pr...

Can I do a multidimensional char array in c++?

First off, this is a "homework" question so vector libraries and string libraries are off limits. I'm trying to get to the basics of c++. My intention with this code is to make and use an array of string arrays. A list of words in other words. When I run this code I get a bunch of nonsense. If there is a better way to make a list of w...

How to convert Text to Wave using SAPI with multithreading?

I am trying to convert text to wave file using following function. It works fine if called from main UI thread. But it fails when calling from another thread. How to call it from a multi-threaded function? void Pan_Channel::TextToPlaybackFile( CString Text, CString FileName ) { // Result variable HRESULT Result = S_OK; // Voice Obje...

double type digits in C++

The IEE754 (64 bits) floating point is supposed to correctly represent 15 significant digit although the internal representation has 17 ditigs. Is there a way to force the 16th and 17th digits to zero ?? Ref: http://msdn.microsoft.com/en-us/library/system.double%28VS.80%29.aspx : . . Remember that a floating-point number can only appr...

What are the STL string limits?

What are the string limits for the Standard Template Library in C++? ...

Multithreading in wxWidgets GUI apps?

Hello there, I'm having problem (basically, I'm confused.) while trying to create a worker thread for my wxWidgets GUI application that WILL MODIFY one of the GUI property itself. (In this case, wxTextCtrl::AppendText). So far, I have 2 source files and 2 header files for the wx program itself (excluding my own libs, MySQL lib, etc), s...

Check double variable if it contains an integer, and not floating point

What I mean is the following: double d1 =555; double d2=55.343 I want to be able to tell that d1 is an integer while d2 is not. Is there an easy way to do it in c/c++? ...

"Nonrepresentable section on output" error during linking on linux

I get this error at the linker stage when compiling the webkit-1.1.5 package on my Ubuntu 9.04 box: libtool: link: gcc -ansi -fno-strict-aliasing -O2 -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -W...

C++ program halts after dynamic memory allocation

I'm having problem with a copying method in a simple C++ program. Everytime I call copy: Sudoku::SudokuNode** Sudoku::copy(SudokuNode** sudokuBoard) { SudokuNode** tempSudokuBoard = new SudokuNode*[9]; for(int i = 0; i<9; i++) { tempSudokuBoard[i] = new SudokuNode[9]; for(int j = 0; j<9; j++) { tempSudokuBoard[i][j].c...

How can I communicate between two C++ MFC plugins?

I have a plugin for a c++ MFC app. I'm working with the developer of another plugin for the same app, that's trying to get notifications of events in my code. Both plugins are in the form of c++ dlls. How can I pass messages from my plugin to his plugin? The solution needs to be robust to mismatched versions of our two plugins, as we...

Is there any advantage in using a reference argument in this function?

I have defined the following class: class Action { public: Action(){ _bAllDone = false; } void AddMove( Move & m ); private: std::deque<Move> _todo; bool _bAllDone; }; The member AddMove is defined as follows: void Action::AddMove( Move & m ) { _todo.push_back( m ); } I noted that without the...

c++ vectors - Using find(begin, end, term)

Ok, i'm doing this and it works fine. end = std::find(arToken.begin() + nStart, arToken.end(), "."); I want to extend the . to include ! and ? so it finds periods(.), exclamation mark(!), and question mark(?). Should i use regex in the term? TIA ...

Header class file to be used by others

Hi, I would like to know if there is a way to put only protected and public stuff on the header file .h, and all private stuff in the compile unit .cpp I need this because the library is going to be used by others, and I wouldn't like to have to copy and edit all .h files to remove private declarations and implementations. I tried but g...

c++ winsock2, how to tell when a connection closes

I have a c++ program using winsock2. I would like to know how to tell when someone's connection to my program closes. ...

Is it possible to force a string to be a specific size when defining a struct?

I am marshalling data between a C# and C++ application. In the C# application, I force the size of a string to be some size (say, 256 bytes). I would like to read in that exact same amount in C++ (I will be recreating the structs with reinterpret_cast) so that the data will remain formatted as it was in the C# application. Unfortunate...

Can I make a bitwise copy of a C++ object?

Can C++ objects be copied using bitwise copy? I mean using memcopy_s? Is there a scenario in which that can go wrong? ...

traversing a singly linked list in C++

Hey everyone, I was wondering if it is possible to traverse a linked list like this: currentNode = randomNode;//where randomNode may or may not = firstNode prevNode = firstNode; while(prevNode != currentNode } Is it possible to do this in C++ when I am trying to find the node before currentNode in a singly linked list? I trying to...