c++

NetShareGetInfo and Access Level? (Win32/C++)

I'm wondering if the method NetShareGetInfo requires the same level of access, reguardless of the level you are requesting. For example SHARE_INFO_0 returns just the shi0_netname where SHARE_INFO_2 the shi2_netname, shi2_type, shi2_remark, shi2_permissions, shi2_max_uses, shi2_current_uses, shi2_path and shi2_passwd. Some of these items ...

std::stringstream to read int and strings, from a string.

Hi everyone, I am programming in C++ and I'm not sure how to achieve the following: I am copying a file stream to memory (because I was asked to, I'd prefer reading from stream), and and then trying to access its values to store them into strings and int variables. This is to create an interpreter. The code I will try to interpret is ...

QSignalMapper and original Sender()

I have a bunch of qComboboxes in a table. So that I know which one was triggered I remap the signal to encode the table cell location (as described in http://stackoverflow.com/questions/1332110/selecting-qcombobox-in-qtablewidget) (Why Qt doesn't just send the cell activated signal first so you can use the same currentRow/COlumn mechani...

Auto linking dependencies of a static lib

I have a static lib A, which also uses static libs B, C and D. I then have applications X and Y which both use A, but not B, C or D. Is there some way to make it so X and Y will automatically see that A used B, C and D and link them, so that I don't need to keep track for the entire dependency tree so I can explicitly pass every static...

Finding last element in linked structure heap

I was wondering how you would go about finding the furthest element in a linked structure implementation of a heap and the root element. I want to be able to Enque and Deque elements. Some clarification: what I meant was lets say you have a linked structure making up a max heap (root element has the largest value). Your tree would have...

Openfeint caused this: ISO C++ forbids of declaration 'myClass' with no type

To cut a long story short, my project (an iPhone app) was all working fine until I started using a C++ sdk (openfeint). Everything was working fine, including the C+++ Openfeint stuff, until I switched from tesitng on the device to testing in the simulator. Now it won't compile for anything and I'm getting just under 200 errors. It's a...

Rounding to use for int -> float -> int round trip conversion

I'm writing a set of numeric type conversion functions for a database engine, and I'm concerned about the behavior of converting large integral floating-point values to integer types with greater precision. Take for example converting a 32-bit int to a 32-bit single-precision float. The 23-bit significand of the float yields about 7 dec...

How to relate WAVE_MAPPER audio line with its audio device

Hello fellow programmers, I'm developing an application that among other things, enumerates all input audio devices (using SetupAPI) and then for each audio device, it lists all input audio lines (using winmm.dll). Basically, the way I'm relating the two is getting the device path from the audio device and then using waveInMessage to ...

Checking Mutex release

I have a multithreaded application written in C++. And I'm using mutex for file writes. I have a suspicion that somewhere during the execution of the program, the mutex isn't being released. So I was wondering if there was a way to check for mutex locks and releases on a file, programmatically or otherwise. I'm running the code on SuseLi...

C++ Declarative Parsing Serialization

Looking at Java and C# they manage to do some wicked processing based on special languaged based anotation (forgive me if that is the incorrect name). In C++ we have two problems with this: 1) There is no way to annotate a class with type information that is accessable at runtime. 2) Parsing the source to generate stuff is way to compl...

C++, oop, list of classes (class types) and creating instances of them

Hi, I have quite a lot of classes declared, all of them are inheriting from a base (kind of abstract) class ... so all of them have common methods I'd like to use ... now, I need to have a list of classes (not objects), later make instance of them in a loop and use the instances for calling mentioned common methods ... the pseudo-code...

Standalone, OS-independent, Architecture-neutral, Multi-threaded Library

What multi-threaded C++ library can be used for writing Linux, Windows, Solaris, and iPhone applications? Such as: TBB Boost OpenMP ACE POCO Any others? ...

Initializing a public char buffer dynamically

I am a noob to C++. I have a question regarding initialization of a character buffer dynamically class Pkg { public: Header t; char buf[LENGTH]; }; I am going to send the object of the class over the network. Header class is converted to network byte order So, I want to send it like this Pkg ackpkt; sendto(sd, &ackpkt, si...

Mapping enum values to strings in C++

Is there a way to, at runtime, map the value of an enum to the name? (I'm building with GCC.) I know GDB can do it and I'm willing to use something that's unportable and mucks with debug data. Edit: I'm looking for a solution that doesn't require modifying the original enum declaration nor hand copying all the values out in a mapping...

Cross-platform OOP in C++

Of course, I know the best answer is "don't write your own cross-platform code, someone has already done what you need," but I'm doing this as a hobby/learning exercise and not in any paid capacity. Basically, I'm writing a smallish console application in C++, and I'd like to make it cross platform, dealing with things like files, socke...

How is C# inspired by C++ more than by Java?

When looking at the history of C#, I found out that C# was seen as an update to C and/or C++. This came a bit as a surprise to me, as on the surface, I see much more common ideas between C# and Java (Garbage collection comes to mind). I don't write code in Java, but I have usually no problem following Java code, and routinely read books ...

Limiting framerate of programs externally

Trying to find a way to limit the framerate of programs/games externally in a similar fashion to VSync, but to a specified number (instead of screen refresh rate). A perfect example of what I am aiming for can be seen in FRAPS, when recording a video the framerate is limited to the recording rate. The reason is for fast pace games which ...

Problem with storing COM pointers in global singleton object

Background The application I am working with has several COM DLLs. One of the COM DLLs has a global singleton object, which stores pointers to COM interfaces in other DLLs. Because it is a global singleton object, I have employed the lazy initialization idiom because it is possible that the interface I am trying to get a pointer to ex...

What is a good way to test whether a file has required permissions?

I see that ifstream::open() returns void and does not offer any way to see if the file did not open due to permissions. What is a good api to test whether read permission or alternatively write permissions are available on a file for the current process in C++? ...

C++: Forward declaration of class doesn't seem to work?

The follwing code is compiled in VC++6. I don't understand why I am getting the compilation error "C2079: 'b' uses undefined class 'B'" for the following code? //Class B Source #include "B.h" void B::SomeFunction() { } //Class B Header #include "A.h" struct A; class B { public: A a; void SomeFunction(); }; /...