Browsing Questions About c++ (1)
How to use the C socket API in C++ on z/OS
I've been having issues getting the C sockets API to work properly in C++. Specifically, although I am including sys/socket.h, I still get compile time errors telling me that AF_INET is not defined. Am I missing something obvious, or could this be related to the fact that I'm doing this coding on …
Is gettimeofday() guaranteed to be of microsecond resolution?
So I find myself porting a game that was originally written for the Win32 API to Linux (well, porting the OS X port of the Win32 port to Linux), and have implemented QueryPerformanceCounter by giving the uSeconds since the process start up:
BOOL QueryPerformanceCounter(LARGE_INTEGER* performa…
GTK implementation of MessageBox
I have been trying to implement Win32's MessageBox using GTK. The app using SDL/OpenGL, so this isn't a GTK app.
I handle the initialisation ( gtk_init ) sort of stuff inside the MessageBox function as follows:
int MessageBox(HWND hwnd, const char* text, const char* caption, UINT type) {…
BerkeleyDB Concurrency
This isn't a question, just more seeking expert advice.
What's the optimal level of concurrency that the C++ implementation of BerkeleyDB can reasonably support? How many threads can I have hammering away at the DB before throughput starts to suffer because of resource contention? I've read t…
Should I use nested classes in this case?
I am working on a collection of classes used for video playback and recording. I have one main class which acts like the public interface, with methods like play(), stop(), pause(), record()...etc. Then I have workhorse classes which do the video decoding and video encoding.
I just learned ab…
Robust Random Number Generation in C++/C#
I'm looking for a performant, reasonably robust RNG using no special hardware. It can use mathematical methods (Mersenne Twister, etc), it can "collect entropy" from the machine, whatever. On Linux/etc we have a drand48() which generates 48 random bits. I'd like a similar function/class for C++ or…
Build for Windows NT 4.0 using Visual Studio 2005?
My research to date indicates that it is impossible to build an application for execution on Windows NT 4.0 using Visual Studio (C++, in this case) 2005. Is this really true? Is there any workaround available?
Easy-to-Use Regular Expression Support in C++?
I'm looking for a robust, easy-to-use, regular expression evaluator for native C++, either platform-independent or Windows-specific.
Requirements:
Can't use Boost or ACE regex libraries (unfortunately)
Can't use .NET Regex (or any managed code)
The main requirement is that it should…
Heap corruption under Win32; how to locate?
I'm working on a multithreaded C++ application that is corrupting the heap. The usual tools to locate this corruption seem to be inapplicable. Old builds (18 months old) of the source code exhibit the same behaviour as the most recent release, so this has been around for a long time and just wasn'…
Exceptions in C++
Exceptions in C++ don't need to be caught (no compile time errors) by the calling function. So it's up to developer's judgment whether to catch it using try/catch (unlike in Java).
Is there a way one can ensure that the exceptions thrown are always caught using try/catch by the calling function…
Asynchronous multi-direction server-client communication over the same open socket?
I have a client-server app where the client is on a Windows Wobile 6 device, written in C++ and the server is on full Windows and written in C#. Originally, I only needed it to send messages from the client to the server, with the server only ever sending back an acknowledgment that it received th…
CPU throttling in C++
I was just wandering if there is an elegant way to set the maximum CPU load for a particular thread doing intensive calculations. Right now I have located the most time consuming loop in the thread (it does only compression) and use GetTickCount() and Sleep() with hardcoded values. It makes sure t…
Mapping Stream data to data structures in C#
Is there a way of mapping data collected on a stream or array to a data structure or vice-versa?
In C++ this would simply be a matter of casting a pointer to the stream as a data type I want to use (or vice-versa for the reverse)
eg: in C++
Mystruct * pMyStrct = (Mystruct*)&SomeDataStream;
pMyS…
Lightweight IDE for Linux
Even though I have a robust and fast computer (Pentium Dual Core 2.0 with 2Gb RAM), I'm always searching for lightweight software to have on it, so it runs fast even when many apps are up and running simultaneously.
On the last few weeks I've been migrating gradually to Linux and want to inst…
How do I configure and communicate with a serial port?
I need to send and receive data over serial connections (RS-232 and RS-422).
How do I set up and communicate with such a connection? How do I figure out what the configuration settings (e.g. baud rate) should be and how do I set them?
In particular I am looking to do this in Java, C/C++,…
Next Page >