I currently use QtScript for scripting functionality in my C++ application, but it's rather "heavy" on the cpu. When a thread evaluates all the scripts in a loop the cpu usage increases to 90%-100%. Even when i put it to sleep for 1 msec every 5 scripts it stays above 75% cpu usage.
Are there any other, easy to implement, scripting fram...
i'm using GetStringUTFChars to retrieve a string's value from the java code using JNI and releasing the string using ReleaseStringUTFChars. When the code is run on JRE 1.4 then there is no memory leak but if the same code is run with a JRE 1.5 and higher version then the memory increases. This is a part of the code:
msg_id=(*env)->GetS...
I've got a little udp example program written using ipv4. If I alter the code to ipv6 would I still be able to communicate with anyone using the listener with an ipv4 address? I was looking at porting examples at
http://ou800doc.caldera.com/en/SDK_netapi/sockC.PortIPv4appIPv6.html
I'm not sure if simply altering the code would ensure ...
Hi, I have a Windows program which has two 2 windows in it:
hwnd (main interface)
hwnd2 (toplevel window, no parent, created by hwnd)
When I double click on hwnd, I need hwnd2 to pop up and show some data, so I use this function to bring hwnd2 to top:
BringWindowToTop(hwnd2);
hwnd2 is brought to top, but there is one thing odd. Wh...
I'm thinking about adding code to my application that would gather diagnostic information for later examination. Is there any C++ library created for such purpose? What I'm trying to do is similar to profiling, but it's not the same, because gathered data will be used more for debugging than profiling.
EDIT:
Platform: Linux
Diagnostic i...
Buffer overrun problems are well known. Thus we were blessed with standard library functions such as wcscat_s(). And the kind folks at Microsoft have created similar safe string functions such as as StringCbCat().
But I have a problem where I need to search a bit of memory for a string. The Standard library function:
wcsstr( wchar_t* ...
I have a test that I'm writing in MSTest, which is managed C++, and I'm trying to test an unmanaged class. Specifically, I'm trying to use the PrivateObject class to call a private method.
This is the code that I have so far:
CUnmanagedType foo;
PrivateObject privateFoo = gcnew PrivateObject( foo );
CString strFromFoo = privateFoo.Inv...
Is there a recommended way to wait on multiple inputs. For example I would like my program to be able to receive input from 3 sources:
Listen on a thread condition e.g. pthread_cond_wait()
Take data from Standard input e.g. getline()
Listen on a socket e.g. accept()
What is the best way to accomplish this? Do I need a thread for each...
Hi All,
Can a C++ compiler (specifically g++) re-order the internal elements of a struct?
I'm seeing some strange behaviour where I have a structure that contains something like the following:
Struct SomeStruct{
...
...
long someLong;
long someLongArray[25];
unsigned long someUnsignedLong;
unsigned long someUnsignedL...
How do I convert a CString to a double in C++?
Unicode support would be nice also.
Thanks!
...
I want to display a map in a MFC application (Visual Studo 2008 with MFC Feature Pack).
Off the top of my head I have the following requirements:
I have to be able to add my own markers (plain lat/lon positions), preferrably with different colors/icons so one can distinguish between different types of markers.
If the map data is fetche...
What is the cleanest way to recursively search for files using C++ and MFC?
EDIT: Do any of these solutions offer the ability to use multiple filters through one pass? I guess with CFileFind I could filter on *.* and then write custom code to further filter into different file types. Does anything offer built-in multiple filters (ie. ...
Hi,
I have a rather large project with a whole bunch of linked dependencies. The problem is that there's a dependency getting linked to which was compiled with VS 2005 and links with the vc80 debug crt, while I've migrated to VS 2008. The problem is that this also means that I must have the vc80 debug crt installed, something which I'd ...
I am trying to combine the following two functions into one portable function:
void NeedleUSsim::FindIdxRho()
{
searchTmp = &ninfo->rho;
double *p = std::find_if(tplRho_deg, tplRho_deg+sampleDim[2], &NeedleUSsim::GreaterThanOrEqualTo);
while(p != tplRho_deg+sampleDim[2])
{
idxRho = p - tplRho_deg;
p = std::find...
I have a linked list with a c-style ctor and dtor.
I just got too frustrated when this if statement decided not to test true, putting me in
an infinite loop. I dont understand why it will never test true.
I am trying to delete a node (the address of a class object) from my LinkedList.
Maybe someone could help me out?
Node *Current = ...
I have a custom Qt widget which I used to display disassembly and I am looking to add syntax coloring to it.
Currently, I simply set the QPen to a solid color, construct the text I want to display, and render it to the QPainter at the appropriate coordinates.
The question is, what is the best approach to adding syntax coloring? I've th...
I am writing an unmanaged DLL in C++. Is using float as a function parameter in a Windows DLL a good idea?
I'd like my DLL to be usable from as many languages as possible (VB6, .NET, etc). To this end, I've used STDCALL and avoided C++ types.
Will most languages handle float correctly? If not, what should I use?
...
Actually, it only fails the second time it's called. I'm using a windowless control to play video content, where the video being played could change while the control is still on screen. Once the graph is built the first time, we switch media by stopping playback, replacing the SOURCE filter, and running the graph again. This works fine ...
I just discovered a bug where the code looked something like this:
char *foo = malloc(SOME_NUM * sizeof(char));
if (!processReturnsTrueOrFalse(foo)) {
free(foo);
char *foo = malloc(SOME_NUM * sizeof(char));
// More stuff, whatever
}
This compiles, but it's weird that I am allowed to define two variables within the same fun...
I'd like the user to be able to edit the number of recent files shown in the File menu of my MFC application. I've used two very good references:
http://www.codeproject.com/KB/menus/changemru.aspx
http://www.microsoft.com/msj/0899/c/c0899.aspx
It involves deleting and recreating the CRecentFileList object stored in CWinApp::m_pRecen...