I am passing an empty char array that I need to recursively fill using strcat(). However, in the VS debugger, the array is not empty, it's full of some weird junk characters that I don't recognise. strcat() then appends to the end of these junk characters rather than at the front of the array.
I have also tried encoded[0] = '\0' to clea...
Basically I'm trying to compile a template class which is meant to represent a table for adding up polynomials. As a result of this the table needs to be nullable.
This is the sort of thing I am trying to represent http://www.mathsisfun.com/algebra/polynomials-adding-subtracting.html.
And this is the template which is meant to do it:
...
Hi
I have a CAB file that installs our program to Windows CE.
I have a CAB (and platform configuration) for Windows CE 5 and 6.
Both CABs have their CE Setup DLL property pointing to the Primary Output of a Setup project.
Both CABs contain the exact same code (C++).
When installing the CE5 CAB it works perfectly and the custom setup a...
Hi, I have an application that connects to an LDAP server using SSL. The problem I'm having is that when I run it as a console application it connects successfully, but when I run the application as a windows service, it fails.
There is some information that could help:
ldap_sslinit ALLWAYS returns success
1 ldap_connect = 0 (Succes...
Can g++ and minGW on Windows XP use the Windows SDK?
Specifically, why does g++ fail to compile:
#include <stdio.h>
#include <windows.h>
int main(void) {
printf("!!!Hello World!!!");
return EXIT_SUCCESS;
}
I have tried compiling by by running:
g++ -c -Wall Test.cpp -IC:/Program\ Files/Microsoft\ Platform\ SDK/Include/
I get a ...
Possible Duplicate:
Why does C have a distinction between -> and . ?
Lets say that I have this structure:
struct movies
{
string title;
int year;
} my_movie, *ptrMovie;
Now I access my_movie like this: my_movie.year = 1999; Now to access a pointer I must do this: ptrMovie->year = 1999;
Why do pointers use the -> oper...
Ok, I'm really confused by this behaviour in VS2008.
This code..
char data[512] = "";
char c[1] = "";
c[0] = '1';
strcat(data, c);
.. results in data being set to this string value: 1ÌÌÌÌhÿ
Surely it should just be 1?
How can I ensure data only contains the single char[] that I copy into it (i.e. 1)?
Why does strcat() copy all t...
An external group provides me with a file written on a Big Endian machine, and they also provide a C++ parser for the file format.
I only can run the parser on a little endian machine - is there any way to read the file using their parser without add a swapbytes() call after each read?
...
Hello,
I have an abstract virtual base class Foo from which I derive many other classes that differ in small ways. I have a factory that creates the derived classes and returns Foo*. One of my bigger problems is in my operator overloads, I need to make sure that the DFoo does not get operated on by DFoo1 (not shown). I have currently ha...
Hi.
I have a Process Control system. It has a huge 2D workspace where all the logic is laid out.
The 2D workspace is a coordinate system.
You usually do not see the whole workspace at once, but rather some in-zoomed part of it focusing on some part of the controlled process. Such subsystem views are bookmarked into predefined named ima...
I am taking a programming class and we are required to use the gcc 4.1.2 compiler to compile our c++ projects. I will be creating my projects in xcode and can't find how to set that compiler. I went to the get info window on the project and hit the drop down under Compiler Version, however I do not have 4.1.2 on the list. It seems that t...
Hi,
I found that there are three ways to catch an exception, what are the differences?
1) catch by value;
2) catch by reference;
3) catch by pointer;
I only know that catch by value will invoke two copies of the object, catch by reference will invoke one. So how about catch by pointer? When to use catch by pointer? In addition to th...
Hi,
Is there any openssl api function to convert PKCS7 file to PEM. I am able to convert a PKCS12 file to PEM using PKCS12_parse() function which returns key and certificate given the password. There is no similar function for pkcs7.
My pkcs7 input has just the certificate in binary format. I am able to do the conversion using command
...
Hi,
I have a large file where each line contains space-separated integers. The task is to sparse this file line-by-line. For the string to int conversion I have three solutions:
static int stringToIntV1(const string& str) {
return (atoi(str.c_str()));
}
However, if I pass a malformed string, it doesn't produce any error. For inst...
I've been challenged with a C++ 3D application project that will use 3 displays, each one rendering from a different camera.
Recently I learned about Ogre3D but it's not clear if it supports output of different cameras to different displays/GPUs.
Does anyone have any experience with a similar Setup and Ogre or another engine?
...
I have a class similar to boost::any, in that it is a templated container class. I'd like to have a method to write the contained value to a string. However, if the contained type doesn't provide a stream insertion operator, I'd like my method to return some default tring rather than failing to compile. Below is as close as I've come, an...
Hi,
i have a very long hex string in a byte array and I would like to format the output of that byte array such that it shows 0x??,0x??. The reason for this because I have a key that I am making and I don't want to type out a 512bit key like that. Any native code that could help me do that would be appreciated.
basically, i have a rsa...
A colleague of mine had a problem with some C++ code today. He was debugging the weird behaviour of an object's virtual method. Whenever the method executed ( under debug, Visual Studio 2005 ), everything went wrong, and the debugger wouldn't step in that method, but in the object's destructor! Also, the virtual table of the object, only...
I'm trying to create a function which is overloaded based on the specialization of its parameter, such as this:
class DrawableObject...;
class Mobile : public DrawableObject...;
class Game
{
AddObject(DrawableObject * object)
{
// do something with object
}
AddObject(Mobile * object)
{
AddObject(dyna...
I am working on a relatively big system with:
low level C++/C codes dealing with multimedia data(video/audio)
a lightweight database, preferably MySQL but I am open to other better alternatives
RESTful web service as the front end
All the requests will be handled by RESTful interface, low level C++/C codes dealing with the real hard...