Hello :)
I'm writing a class library that provides convenient object-oriented frontends to the C API that is the Windows Registry. I'm curious, however, what the best course of action is for handling HREGs, for instances where my key class is copied.
I can either
Allocate a heap integer and use it as a reference count. Call RegCloseK...
Possible Duplicate:
Why is exception handling bad?
I often see/hear people say that exceptions should only be used rarely, but never explain why. While that may be true, rationale is normally a glib: "it's called an exception for a reason" which, to me, seems to be the sort of explanation that should never be accepted by a respe...
I added #ifndef..#define..#endif to a file of my project and the compiler fails. As soon as I remove it or put any other name in the define it compiles fine. What could be the problem?
Sounds like the file is already declared, but I do not know where. I'm fine just removing it, but I really want to know why this is happening.
error:...
Hi,
I'm a student who's learning C++ at school now. We are using Dev-C++ to make little, short exercises. Sometimes I find it hard to know where I made a mistake or what's really happing in the program. Our teacher taught us to make drawings. They can be useful when working with Linked Lists and Pointers but sometimes my drawing itsel...
Why when I entered the loop below and I type something the first instruction
cmdstd:getline(std::cin,cmdInput); does not read the input entered. For instance if I entered "b 8" it should display "cmd is b 8", but it skips to the next read std::getline(std::cin, input); and displays "it is b" instead
while (editingMode == TRUE) {
std...
I've recently encountered what I think is a false-sharing problem in my application, and I've looked up Sutter's article on how to align my data to cache lines. He suggests the following C++ code:
// C++ (using C++0x alignment syntax)
template<typename T>
struct cache_line_storage {
[[ align(CACHE_LINE_SIZE) ]] T data;
char pad[ C...
I can tell how many USB HID devices I have (7), but every time I try to get details on any device, the path returned for it is always "\", making it so that I can't access the device at all. I'm using code that is very similar in procedure to this code:
HANDLE connectDeviceNumber(DWORD deviceIndex)
{
GUID hidGUID;
HDEVINFO hard...
I made a server with SSL and blocking sockets.
When I connect with telnet (so it does not do the handshake), the SSL_accept blocks indefinitely and blocks every new handshake/accept (and by definition new connections).
How can I solve this awful problem ?
...
I'm trying to find open source applications using PostgreSQL that are written in C/C++ so I can study them. A few open source projects using PostgreSQL are Evergreen ILS, SpamAssassin, and pgpool. However, Evergreen and SpamAssassin are written in Perl, and pgpool (written in C) is a replication tool, not a typical application. Moreov...
Is there a reason why if in my program I am asking the user for input, and I do:
int number;
string str;
int accountNumber;
cout << "Enter number:";
cin >> number;
cout << "Enter name:";
getline(cin, str);
cout << "Enter account number:";
cin >> accountNumber;
Why after inputting the first number, it outputs "Enter Name", followed im...
I have a DLL that was written in C++ and called from a C# application. The DLL is unmanaged code. If I copy the DLL and its .pdb files with a post build event to the C# app's debug execution dir I still can't hit any break points I put into the DLL code. The break point has a message attached to it saying that "no symbols have been loade...
Building a file open dialog replacement. Much of it works now, but I would like to generate the view-mode drop-down for the toolbar directly from the shell view object.
Looking at IShellView2, I can see IShellView2::GetView() will give me the FOLDERVIEWMODE's supported. However, that doesn't give me the names of these modes, nor forma...
I have a C++ application that I am porting to MacOSX (specifically, 10.6). The app makes heavy use of the C++ standard library and boost. I recently observed some breakage in the app that I'm having difficulty understanding.
Basically, the boost filesystem library throws a runtime exception when the program runs. With a bit of debugging...
I was trying to use otool but I couldn't find a way to do it. Basically I'd like to know whether a dylib is compiled only for 10.6 or if it supports 10.5.
Thanks,
Rui
...
I've got a QList of QLineEdit*'s
QList<QLineEdit*> example;
Example will hold 100 items of lineEdits.
When I try to save or load to a file, it fails to save or load the QList properly, if at all. I get a much lower than expected count of data.
I see on QList<T>'s resource page here that there's the correct operator for << & >>,
ho...
#include<string>
using namespace std;
int main(){
const int SIZE=50;
int count=0;
ifstream fin("phoneData.txt");
ofstream fout("phoneList.txt");
string firstName, lastName, phoneNumber;
if (!fin){
cout<<"Error opening file. program ending."<<endl;
return 0;
}
while (count<SIZE && fin>>phoneNumbe...
What types in C++ can be instantiated?
I know that the following each directly create a single instance of Foo:
Foo bar;
Foo *bizz = new Foo();
However, what about with built-in types? Does the following create two instances of int, or is instance the wrong word to use and memory is just being allocated?
int bar2;
int *bizz2 = new ...
i have an array of strings of phone numbers, and i have to insert hyphens into them. what string function should i use, and how?
thanks. :D
...
I'm wanting to dynamically resize a CButton to the width of the text within it. Is there either a built-in way to do this in MFC, or a way of calculating the pixel width of some specified text (so that I can use CWnd::SetWindowPos)?
...
Can .h files see what's in each other without being included? I know when I programmed in C before I could use variables in a .h file from other .h files without #include "myfile.h". I'm trying to do the same in C++ and I keep getting "definition out of scope error"
...