c++

Pass path to file / filename as argument to a function that prints the file to screen in C++.

As the title says, is there any way to pass the path to the file / filename to open as an argument in the function? I've written a short code for printing a .txt-file to the screen in C++, but instead of having all the code in the main(), I'd rather have it as an own function that I can call with the filename of the file to open as the ...

Compiler error with boost iterator adaptor

I am trying to write a simple STL iterator for CArray MFC class using boost iterator adaptor. This is my code: #include <boost/iterator/iterator_adaptor.hpp> #include <afxtempl.h> class CArrIter : public boost::iterator_adaptor< CArrIter , int, int, boost::random_access_traversal_tag > { public: CArrIter(CArray<int,in...

How to judge whether a driver is a floppy or a removable flash disk in C++?

I wonder if there is an API to distinguish floppy and flash disk in windows, C++ And is it possible to link a flash disk to A:\? Many Thanks! ...

CreateProcess, process do not terminate when redirecting std out/in/err

Hi, I'm trying to use CreateProcess to launch a powershell script from within my application. I've used the Microsoft example (http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx) to create the child process and redirect the standard out/in/err pipes. The only issue left to solve is why the child process (powershell) do not ...

boost::spirit composing grammars from grammars

I have figured out how to use spirit -- i.e., I have written a moderately complex grammar. I always take the approach of growing a program -- one subsystem at a time. I've written the data structures for a complex model which has 4 types at the highest level. I would like to use the grammar composed from rules approach to parse the top...

Can I add file in Visual Studio 2003 and make it point to an existing file in another project?

This is a question about using Visual Studio 2003. Sorry it is not strictly a programming question but it does affect my work in a rather annoying way. I have a solution with 3 different projects (let's say MyProgram, UnitTest and PerformanceTest), and there is a file (let's say myclass.h) which needs to be shared between the 3 projects...

Dynamically resizing a dialog at runtime to fit embedded WebBrowser

Hi, I am creating a WebBrowser ActiveX control inside an ActiveX dialog (ATL::CAxDialogImpl). The control is loaded with some text content at run-time before the dialog is displayed, and so the dialog window must be resized dynamically in order to fit the WebBrowser control. I've seen a similar question asked with C# but couldn't get it...

How to read the mp3 files in a given folder?

how to read the mp3 files and display those file names using c++ can anyone provide me code for this in C++? ...

How to create artificial nodes in QAbstractItemModel for QTreeView

Hi, my question is about Qt and its QAbstractItemModel. I have a map of strings and doubles (std::map<stringclass, double>) which I would like to present in a Qt widget. While I could use QTableView for that, I would like to exploit the fact that the keys of the map are of form "abc.def.ghi" where there can be multiple strings that c...

Use vb.net in VBScript

Hi! How to call a function in vb.net DLL from VBScript? I did the following: - I create public class named Class1 in vb.net. I go to Visual Studio 2008 Command Prompt and go to my class dll - C:\Myapp\bin\Debug and type following command tlbexp myDLL.dll after that i get message Assembly exported to C:\Myapp\bin\Debug\myDLL.tlb Aft...

Core dump analysis using gdb

I have a couple of questions regarding core dumps. I have gdb on Windows, using Cygwin. What is the location of core dump file? Is it a.exe.stackdump file? (This is the only file that generated after crash) I read on other forums that the core dump file is named "core". But I don't see any file with name "core". What is the command for...

c++ Socket select and receive problem

Hi all; Below is the code fragment I have issue with socket programing. Here after select call, If I do not put a sleep on line 9, on Windows XP, 1 byte is received on line 11 (instead 4 byte is sent from server as integer), when I check xmlSize, it is set to 0. Because iResult is 1, execution continues and on line 15 second receive is c...

volume shadow copy vs data protection manager

trying to implement a VSS backup solution similar to what is described here: http://stackoverflow.com/questions/692848/volume-shadow-copy-vss there is a new offering called data protection manager: http://www.microsoft.com/systemcenter/dataprotectionmanager/en/us/overview.aspx how different is this from VSS based solution? does it sol...

Comprehensive gnu make / gcc tutorial

I've just started learning C++ and I find it very hard to find short, comprehensive tutorials on how to use gnu make / gcc. Any ideas (please don't point me to the official gnu make tutorial, it's way too much in-depth for my purposes ;-)). ...

How to call XML api

Hello, I have a set of XML API's ( XSD ) files. I want to call them from C++ and C# programs. These are two different applications. I want to get data by calling the api. I would also like to know something about XML RPC Can someone please let me know how do I call the XML api from C++ and C#. Thanks Sujay ...

Sentinel while loop for C++

Can anyone tell me what is sentinel while loop in C++? Please give me an example using sentinel while loop. ...

C++ empty class or typedef

Hi, I'm currently using something like that in my code: class B : public A<C> { }; Wouldn't it be better to use a typedef? typedef A<C> B; ...

Sourceannotations.h ? C++

What is this errormessage in Visual Studio 2008 Error 1 error C2144: syntax error : '__w64 unsigned int' should be preceded by ';' c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h 19 Steg2_Labs I don't have any headerfiles made myself. ...

C++ STL List calculate average

I have to correct some C++/STL code. Unfortunately I have very little C++ experience and know nothing about STL. Nevertheless I finished most of it, but the function below is still giving me problems: C++ source: double MyClass::CalculateAvg(const std::list<double> &list) { double avg = 0; std::list<int>::iterator it; for(i...

Using LTI-Lib in QT

How can I use LTI-Lib in QT? ...