c++

create file on desktop in c++

i know that to create file in c++ we use following code #include <iostream> #include <fstream> using namespace std; int main(){ ofstream out; out.open("exemple.txt"); return 0; } my question is following i want create example.txt file on desktop or in other directory for simplify let's take desktop how? please help like this? ...

In Revit how to manipulate the tangents of Hermite spline programly ?

I want to choose 3d graphic (not for game) development as my major growing direction. Which books should i read? Which background knowledge I need to learn? ...

Lockless reader/writer

Hi, I have some data that is both read and updated by multiple threads. Both reads and writes must be atomic. I was thinking of doing it like this: // Values must be read and updated atomically struct SValues { double a; double b; double c; double d; }; class Test { public: Test() { m_pValues = &m_value...

Critical Section OwnerShip

If a critical section lock is currently owned by a thread and other threads are trying to own this very lock, then all the threads enter into a wait queue. When the initial owning thread releases the criticakl section lock, then one of the threads in the waiting queue owns the thread. kindly if i am told how the owner is decided as it is...

SDL_WaitEvent: How to kill everything in queue?

Hi, I'm using this in my main loop: if (SDL_WaitEvent(&event)) { switch (event.type) { case SDL_MOUSEBUTTONDOWN: mainClicker(event.button.x, event.button.y); break; ..... etc Everything works fine, but: In "screen 1" user does stuff and clicks a button. The app then does its stuff ...

c++ convert class to boolean

With all of the fundamental types of C++, one can simply query: if(varname) and the type is converted to a boolean for evaluation. Is there any way to replicate this functionality in a user-defined class? One of my classes is identified by an integer, although it has a number of other members, and I'd like to be able to check if the i...

File browsing application in vc++

Hi all, I'm building an application in vc++. Here I want to browse my file system and select some file. Can anybody tell me how to do? Thank you. ...

Get integer date representation (epoc time or jan1st 0001 base) from string ( Fri 4/2/2004 9:55:54 AM --------> <long representation>)

I have the date in a string in the following format. Fri 4/2/2004 9:55:54 AM I would like to have a generic time utility in c++ which parses this and provides me the long/int representation which is either the epoc time base or Jan 1st 0001 time base. (Wish list) Also, it will be good if the util is fairly generic, in the sense that, ...

Getting value from two dimensional Safearray in C++

Am relatively new to the world of C++. I wish to access the data from a multi-dimensional SAFEARRAY. However when I try to retrieve the value, I get the error 0xC0000005: Access violation reading location 0x40e3e300. Attached below is my code and the marked line is where it errors out. Hopefully someone can shed some light as to how to a...

Avoid stepping into c++ std header files in Visual Studio 2008 Debugger

Possible Duplicate: Is there a way to automatically avoiding stepping into certain functions in Visual Studio? Good Morning, I'm looking for a way to tell the debugger to avoid stepping into some header files that are of no interest to me when debugging my code. Example: When I have a std::string as a parameter of a function...

DDEConnect failing on Unicode

Hello, Why is it that DdeConnect is failing on Unicode but yet working on ANSI? 1) Open Excel and enter some dummy data 2) Create a sample code to read value from Excel via DDE 3) ANSI = Success, Unicode = FAIL Sample code below. I am getting DDE Connection Failed everytime. WCHAR szApp[] = L"Excel"; WCHAR szTopic[] = L"C:\\Tes...

Strange linkage problem with Visual C++ 2005

Hello, please help me, I have a strange problem which i can't sort out in any way. Premise: I'm using visual c++ 2005 on windows 7 x64, and I'm sure that my code isn't fatally flawed because with g++ under Linux it runs nicely. I am developing an application which uses a static library also developed by me. In the link phase of the a...

C++ reinterpret_cast

Hi, I don't know why this simple code is not working. Can someone please explain me? int main() { const char* c = "ret"; typedef unsigned char GOK_UINT8; typedef GOK_UINT8* pGOK_UINT8; const pGOK_UINT8 y = reinterpret_cast<const GOK_UINT8*>(c); return 0; } Can someone tell me why the reinterpret_cast should no...

Console output in a Qt GUI app?

I have a Qt GUI application running on Windows that allows command-line options to be passed and under some circumstances I want to output a message to the console and then quit, for example: int main(int argc, char *argv[]) { QApplication a(argc, argv); if (someCommandLineParam) { std::cout << "Hello, world!"; return 0; ...

What C++ string classes/systems exist that have good unicode support and a decent interface?

Using strings in C++ development is always a bit more complicated than in languages like Java or scripting languages. I think some of the complexity comes from a performance focus in C++ and some is just historical. I know of the following major string systems and would like to find out if there are others and what specific drawbacks th...

How can I define a typemap for SWIG, that converts a reference argument from C++ to C#

I have a C++ library which provides the following enum and function: typedef enum en{ a, b }myEnum; int myFunction( myEnum &varToSet ) { varToSet = 1; return 0; } The function in the C# Wrapper should look something like this: public static int myFunction( ref myEnum varToSet ) I have tried to get this result by following ...

plugin pattern with .dll. how can I extract plugin interface from dll?

I have an application that's suppose to be realized in plugin pattern. Plugins are located in dll files and I'm loading them on the fly, depending on the parameter given from a user via command line. That is, if user wants to use plugin1 he types that name as a parameter in command line when running the app and I am supposed to load it o...

Multiple Inheritance Template Class

class messageA { }; class messageB { }; template<class T> class queue { public: virtual ~queue() {} void submit(T& x) {} }; class A : public queue<messageA>, public queue<messageB> { }; int main() { A aa; aa.submit(messageA()); aa.submit(messageB()); } My first thought is, the above code should be fine, as class...

making a web services query using gSoap with query arguments

I'm attempting to convert a soap query written for C# into a gSoap query in Visual C++. The C# query adds an XML node's to the query call, in order to pass parameters to the query: XmlNode queryOpts = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", ""); queryOpts.InnerXml = "<DateInUtc>TRUE</DateInUtc>"; Here's the C# query, p...

QT and SQLITE problem during building

Hi, I'm developing a simple application to use sqlite, the problem is that the following code /* ... */ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("hellogoodbye"); if (!db.open()) { QMessageBox::critical(0, qApp->tr("Impossibile aprire il database"), qApp->tr("Non ...