c++

A link problem with Windows 7 shell functions

Hello, I'm trying to enumerate files through the Windos 7 library API, e.g. with SHLoadLibraryFromKnownFolder I'm using a C++ win32 console application and getting link errors, e.g., Error LNK2019: unresolved external symbol __imp__DSA_DestroyCallback@12 referenced in function "void __cdecl DSA_DestroyCallback(struct _DSA *,int (__stdc...

Create a dialog in UI Thread causes crash

I tried to create a dialog in a UI thread(CWinThread). However, it crashes when the CDialog::Create() is called. I had verified with previous implementation, the dialog is successfully created in non-threading mode. Does any guru here know the crash reason of creating a dialog in CWinThread? Without Threading: class CProduction : publ...

very simple io question c++

Just started learning c++ today and im pretty boggled. its an amazing language but im having some trouble overwriting a file #include <iostream> #include <fstream> using namespace std; int main( ) { double payIncrease = 7.6; double annual; double annualIncrease; double newAnnual; double monthlyIncrease; doub...

Dynamically list all members of a class

Hi, Is it possible in C++ to dynamically (during run-time) get a list of all members of the class? Greetings ...

How to display the Date time from timeval in c++

Hello all, I am using timeval throughout my project. I want to display Date and time like, Sep 15, 2010 - 11:10 using the available timeval object. Is there any way to do it or can I get time_t from the available timeval. Thanks. ...

Is MSFTP supposed to delete a partially uploaded file if the upload terminates abruptly?

I have a strange phenomenon: I upload a file to MSFTP Server using my C++ app. When the upload is in progress, I use TaskManager to kill the app, I reconnect to the server and the file has disappeared. Has anyone known this issue before? I do not use any deletion command in my app. ...

When is "extern C " necessary in c++ in windows?

As we know that we can use c functions directly in c++, when is extern "C" necessary then? ...

close an unopened stream

Hello, I have ifstream and an ofstream that in runtime might be opened or not (depends on what the user enters in command line. i declare the variables anyway, and i have a method that opens the stream if needed. my problem is at the end of the program i don't know if i need to close them or not. Is there anyway in c++ to know if a st...

Deselecting radio buttons

I am creating an application in which i use different group box for different categories which contains radio buttons for items.But if i select an item from one group box and then from another group box,the item in previous group box remains checked. But i want that whenever i select an item from different group box all other item must g...

MS VC++ 6 command line compile gets error RC1015: cannot open include file 'afxres.h'

I have some projects tethered to MS VC6 [I understand it's a 10+ yr old compiler. I understand it's got some issues. It's what I have to work with, for now.] In an attempt to automate some builds, I'm trying to get the msdev command-line compile to work. Everything looks to be working UNTIL the end, when it errors on the file 'afxres....

How do I use a C++ class in a C# application without regard to platform?

I have a native/unmanaged C++ library with a number of classes that I would like to use from C#. Most of the solutions I've read (like this one and this one) suggest that I should create a C++/CLI wrapper, and use the wrapper in my C# project. Most of these suggestions, however, ignore platform. As far as I am aware, if the unmanaged DLL...

The importance of declaring a variable as unsigned

Is it important to declare a variable as unsigned if you know it should never be negative? Does it help prevent anything other than negative numbers being fed into a function that shouldn't have them? ...

Visual Studio 2010 & 2008 can't handle source files with identical names in different folders?

Direct Question: If I have two files with the same name (but in different directories), it appears that only Visual Studio 2005 can handle this transparently?? VS 2008 & 2010 require a bunch of tweaking? Aside from my naming convention, am I doing something wrong? Background: I'm developing C++ statistical libraries... I have two fo...

Vector class in c++ programing

Can anybody explain me, what is use of vector class? My Professor mentioned about below sentence in the lecture. Template: Each vector has a class parameter that determines which object type will be used by that instance, usually called T. I don't understand what exactly class parameters means? ...

Assigning a const char[] do you need to put in a null term

We are setting a char [] to some hex values i.e. char [] test1 = {0x30,0x31,0x32,0x33,0x34,0x35}; Then we copy it into a string using string teststring(test1, sizeof(test1)); Is the array suppose to be null terminated? or is the way we do the assignment, C++ is smart enough to know that its null terminated and have it appended anyh...

Can static local variables cut down on memory allocation time?

Suppose I have a function in a single threaded program that looks like this void f(some arguments){ char buffer[32]; some operations on buffer; } and f appears inside some loop that gets called often, so I'd like to make it as fast as possible. It looks to me like the buffer needs to get allocated every time f is called, but ...

Show form from another form

Hi. I have 2 forms Form1 and Form2. How can I, inside code (Form1.h) show Form2 (something like Form2::Show()) ...

How do I change the Projection so it shows my object?

Hello, I have an 2D object (GL_QUAD) with size (W,H) and sitting at (-W*0.5, -H*0.5). I'd rather not resize the object, because I need to be able to select points on that object relative to the texture. (i.e. (x,y) in openGL translates to (x,y) on the texture - no scaling needed). What I want to do is change the camera properties (pro...

What does this C code do?

I'm really new to C programming, although I have done quite a bit of other types of programming. I was wondering if someone could explain to me why this program outputs 10. #include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <sys/wait.h> #include <stdlib.h> int value = 10; int main() { pid_t pid; pid = for...

What is the best way to visualize my small c programs using some type of diagrams ?

I want to learn how can I visualize my small c programs using some type of diagrams . My programs generally include (3 or 4 functions) (some loops) (basic i/o (printf scanf)), and basic calculations. I do not want to visualize everything about my program(name of vars, type of vars) , but I want to create some type of diagram which will ...