Every so often, I'll have to switch between languages for the majority of the code I write (whether for work or for play). I find that C++ is one of those languages that requires a lot of mental cache space, so if I take a long break from it, then I forget a lot of the details. Even things like adding items to an STL container or using ...
I'm looking for a well-written, flexible library written in C or C++ (I'm writing my apps in C++) that can be used to embed an relatively simple HTTP server into my applications. Ultimately I will use this for application monitoring and control.
There are a number of great client-side libraries (e.g. libwww, neon, curl) but I'm struggl...
I know you can use C++ keyword 'explicit' for constructors of classes to prevent an automatic conversion of type. Can you use this same command to prevent the conversion of parameters for a class method?
I have two class members, one which takes a bool as a param, the other an unsigned int. When I called the function with an int, the ...
Weird issue:
Open a large notepad window
create a toolwindow (style WS_EX_TOOLWINDOW)
create 2 more windows (normal overlapped) (WS_OVERLAPPED)
close those 2 overlapped windows (child of desktop or the toolwindow)
the toolwindow jumps behind the notepad window
Does anyone know why this is the case? Or what I could be doing wrong? I...
I have the following unmanaged C++ code:
MessageBox( NULL, strMessage, "Cool Product", MB_RETRYCANCEL | MB_ICONEXCLAMATION);
I want to disable the RETRY button for 10 seconds (for example), then enable it.
How can I do this?
...
Is it possible to create an STL-like container, or even just an STL-style iterator, for an existing array of POD-type elements?
For example, suppose I have an array of ints. It would be convenient to be able to call some of the STL functions, such as find_if, count_if, or sort directly on this array.
Non-solution: copying the entire a...
I've written a DLL that monitors our netowork printer. The printer is connected to the server via USB cable. When I print something directly from the server, it displays information about pages sent/printed properly, but when I print something from one of the client computers it only displays its IP, sent/printed is always 0.
I suppose ...
Suppose I have a set of values, stored in a std::set:
{1, 2, 6, 8}
and I have a search key, say, 3. I want to put 3 into a function and get the first value greater than or equal to 3, in this case I would want to get 6.
The find() function provided in map/set/multimap/and set will, of course, return the end iterator for this case. Is ...
Here are the declarations of the variables:
string strFirstName;
string strLastName;
string strAddress;
string strCity;
string strState;
double dblSalary;
string strGender;
int intAge;
...Do some "cin" statements to get data...
retcode = SQLPrepare(StatementHandle, (SQLCHAR *)"INSERT INTO EMPLOYEE ([FirstName], [LastName], [Address],...
In the Google C++ Style Guide, there's a section on Operator Overloading that has a curious statement:
Overloading also has surprising
ramifications. For instance, you can't
forward declare classes that overload
operator&.
This seems incorrect, and I haven't been able to find any code that causes GCC to have a problem with it...
What's the best way to perform a deep copy in the constructor of an object that is part of multi-threaded C++ code?
...
In the early days of C++ when it was bolted on top of C, you could not use NULL as it was defined as (void*)0. You could not assign NULL to any pointer other than void*, which made it kind of useless. Back in those days, it was accepted that you used 0 (zero) for null pointers.
To this day, I have continued to use zero as a null pointer...
I need to convert from a SQLVARCHAR to a string data type
variable definitions as follows:
string strFirstName;
SQLVARCHAR rtnFirstName[50];
Want to be able to accomplish the following:
if (strFirstName.empty()) strFirstName = rtnFirstName;
Gives an error that the binary '=': no operator found which takes a right-hand operand of ty...
I have a std::string with UTF-8 characters in it.
I want to convert the string to its closest equivalent with ASCII characters.
For example:
Łódź => Lodz
Assunção => Assuncao
Schloß => Schloss
Unfortunatly ICU library is realy unintuitive and I haven't found good documentation on its usage, so it would take me too much time to l...
Please anybody can tell me the questions, that can be asked in an interview for below topics
Socket Programming
Multi-Threading
An advance thanks goes to everybody who provide their time
...
What is the data that Process and Thread will not share ?
An advance thanks goes to everybody who provide their time
...
Is there a way to generate a hash of a string so that the hash itself would be of specific length? I've got a function that generates 41-byte hashes (SHA-1), but I need it to be 33-bytes max (because of certain hardware limitations). If I truncate the 41-byte hash to 33, I'd probably (certainly!) lost the uniqueness.
Or actually I suppo...
Does anyone know of a graphing library for simple transformation of a point from one coordinate system to another coordinate system which is rotated by a angle and some point transformation and just for 2d?
And any graphing tool for plotting and verifying the same visually?
...
const static int foo = 42;
I saw this in some code here at StackOverflow and I could'nt figure out what it does. Then I saw some confused answeres at other forums. My best guess is that it's used in C to hide the constant foo from other modules. Is this correct? If so, why would anyone use it in a C++ context where you can just make ...
I am primary a web developer but I do have a very good understanding of C++ and C#. However, recently I have writing a GUI application and I have started to get lost in how to handle the relationship between my controller and view logic. In PHP it was very easy - and I could write my own MVC pattern with my eyes closed - mainly because o...