c++

How to include the calling class and line number in the log using Pantheios?

I just started using Pantheios and it feels really like a great library for logging! Maybe even the greatest one for C++! Congratulations to the author! However, I could not find neither in the documentation nor in all the forum posts anything about how to include the calling class and the line number in the log. I'm using be.file as b...

I'm getting error C2664 on some I/O code.

void BinaryTree::InitializeFromFile(string Filename){ ifstream inFile; inFile.open(Filename, fstream::binary); if(inFile.fail()){ cout<<"Error in opening file "<<Filename; return; } for(int i=0;i<=255;i++) Freq[i]=0; char c; inFile.get(c); while(!inFile.eof()){ Freq[c] ++; inFile.get(c); } } HuffmanTree.cpp(...

NLP project, python or C++

We are working on Arabic Natural Language Processing project, we have limited our choices to either write the code in Python or C++ (and Boost library). We are thinking of these points: Python Slower than C++ (There is ongoing work to make Python faster) Better UTF8 support Faster in writing tests and trying different algorithms C++...

Try does not catch exception in DllImport function

I call C++ function from C# project: [System.Runtime.InteropServices.DllImport("C.dll")] public static extern int FillSlist(out string slist); and then try { FillSlist(out slist); } catch { } C++ dll is protected by third-party tool, so some code is being performed before FillSlist is really executed. Something really bad happens...

Validate HWND using Win32 API

From the native Win32 API using C++ is there a way to determine whether the window associated with an HWND is still valid? ...

Qt Asynchronous Action During aboutToQuit

Hi all, I've got some Asynchronous cleanup activity I need to do as my Qt application is shutting down. My current approach is to trap the aboutToQuit signal. I launch my Asynchronous behavior, and then the application shuts down. Is there any way to block Qt from shutting down until my asynchronous behavior is complete? This works on...

Command arguments in compiler configurations

[edit] I meant to say "command arguments in compiler configs" . for the title. I am trying to get into game mods. And I am trying to implement the source sdk. one of the steps is to go into debugging in my compiler configurations and add some data to the command arguments -dev -sw -game "C:\Program Files (x86)\Steam\steamapps\SourceMod...

Algorithm to add or subtract days from a date?

Hi, I'm trying to write a Date class in an attempt to learn C++. I'm trying to find an algorithm to add or subtract days to a date, where Day starts from 1 and Month starts from 1. It's proving to be very complex, and google doesn't turn up much, Does anyone know of an algorithm which does this? ...

How to create interface for C++ application with XAML?

How to create interface for C++ application with XAML? (I SEARCH FOR SOME APP LIKE EXPRESSION BLEND (OR even beter a plug in for it)) ...

How to get cmake's PKG_CHECK_MODULES to find my cairo library in Windows

I'm trying to build OpenSceneGraph's pdf plugin on a win32 box. The plugin is using cmake's PKG_CHECK_MODULES macro to find cairo and poppler libraries. I don't know how to install these in such a way as to help it find them though. ...

Beginning games programming with C++

Hello all. I've been learning C++ for quite a while and a thought flashed in my mind to do a very simple game. What is my first step? Any libraries available? What books/sites you recommend? Finally, is c++ ok to start with games programming? ...

shallow copy issue!

Have a look at the following code you are not required to read the whole code just read the code of copy constructor and the main program. the following statement in the copy constructor //the statement below should do the shallow copy ptr[currentsize++]=object.ptr[i]; this statement should do a shallow copy in case of array of ...

Tired of building web applications? Trying maybe C++?

I'm getting a little tired of building web applications. Feels like same thing over and over again. Are there any other cool things you can do. I'm maybe getting to start coding in C++. Any suggestions for tips in that area? Should I delve into Qt or MFC? Any suggestions? ...

Alternative version of find_if which finds all, not just the first?

Is there an alternative version of std::find_if that returns an iterator over all found elements, instead of just the first one? Example: bool IsOdd (int i) { return ((i % 2) == 1); } std::vector<int> v; v.push_back(1); v.push_back(2); v.push_back(3); v.push_back(4); std::vector<int>::iterator it = find_if(v.begin(), v.end(), IsOd...

How can I convert the following java function into C++?

If I have the following Java code: int[][] readAPuzzle() { Scanner input = new Scanner(System.in); int[][] grid = new int[9][9]; for (int i=0; i<9; i++) for (int j=0; j<9; j++) grid[i][j] = input.nextInt(); return grid; } public static void main(String[] args) { // Read a Sudoku puzzle int[][] gr...

iostream, some questions

I've seen people do things like.... istringstream ibuf; if (ibuf >> zork >> iA >> Comma >> iB) now I guess the value depends on what >>iB exposes but exactly what is that and what does it mean? Does true mean all the ietms were extracted? Also, after an expression like ibuf >> zork >> iA >> Comma >> iB; is there any way to ...

Select which handles are inherited by child process.

When creating a child process in C++ using Windows API, one can allow inheritance of handles from parent to child. In a Microsoft example "Creating a Child Process with Redirected Input and Output", redirecting a child process' std in/out to pipes created by the parent, it is necessary to allow inheritance for the redirection pipes to be...

Create derived class instance from a base class instance without knowing the class members.

Is this scenario even possible? class Base { int someBaseMemer; }; template<class T> class Derived : public T { int someNonBaseMemer; Derived(T* baseInstance); }; Goal: Base* pBase = new Base(); pBase->someBaseMemer = 123; // Some value set Derived<Base>* pDerived = new Derived<Base>(pBase); The value of pDerived->someBase...

Pointers in C# to Retrieve Reference From DllImport Function

I am referencing a DLL in my C# project as follows: [DllImport("FeeCalculation.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] public static extern void FeeCalculation(string cin, string cout, string flimit, string frate, string fwindow, string fincrement, string fbird, ...

C++ weird thing

Hi there, anyone can explain me, why this parts of code are acting differently? while((c = fread(buf, sizeof(char), 1, f)) != 0); { if(write(t, buf, c) < 0) { return E_MSGSEND; } } ///////////////////////////////////// do { c = fread(buf, sizeof(char), 1, f); if(write(t, buf, c) < 0) { retu...