I have been working on a very large program, compiling, testing, adding new code, compiling testing - repeat. The program has generally been working fine, but then I added some new code and now when I run the executable, I get a dialog box with "xxx.exe is not a valid Win32 application.", I can only assume this is a bug in the compiler. ...
Currently I have the following:
float some_function(){
float percentage = 100;
std::cout << "percentage = " << percentage;
//more code
return 0;
}
which gives the output
percentage = 100
However when I add some std::endl like so:
float some_function(){
float percentage = 100;
std::cout << "percentage = " ...
Hi everyone,
I have a multi-byte primitive type called s32 which I want to read from a byte array.
The specifications are:
It is a 32-bit signed integer value, stored in little-endian order.
Negative integers are represented using 2's complement.
It uses 1 to 5 bytes depending on the magnitude. Each byte contributes its low seven ...
I ran into an error yesterday and, while it's easy to get around, I wanted to make sure that I'm understanding C++ right.
I have a base class with a protected member:
class Base
{
protected:
int b;
public:
void DoSomething(const Base& that)
{
b+=that.b;
}
};
This compiles and works just fine. Now I extend B...
Hello
I am building an C++ application server-client where the client sends an image (170kb) to a server every 200ms.
Using UDP, the files uncompressed are over 64kbs allowed by each datagram (I'd like to avoid compressing the files if possible).
On the other hand I'm having problems setting a TCP connection, I managed stablish a conn...
Hi all,
I have come across a situation (on Win32) where the std::ostringstream object continues to consume process memory, even when it is ostensibly cleared out after a series of append-type operations. Please take a look at this C++ fragment:
int main(void)
{
std::ostringstream cOutputLogStream;
// Random long string
std...
I have created this datastructure:
class Event
{
public:
Event(EVENT_TYPE type, void* pSender = 0, int content1 = 0,
int content2 = 0, int content3 = 0, int content4 = 0);
~Event(void);
// ... some functions
protected:
EVENT_TYPE itsType;
void* itsPointerToSender;
int itsContent_1;
int itsContent_2;
...
Hi everyone,
I'm quite a newbie in c++ and I want to generate just random UUID's, as it is just important for instances in my program to have unique identifiers. I looked into Boost UUID, but I can't manage to generate the UUID because I don't understand which class and method to use.
In Java it is as simple as java.util.UUID.randomUU...
Could anyone recommend good book about programming in windows 7 in C++?
...
I have used QGraphicsView, QGraphicsScene classes in order to show a picture in a widget like this:
m_Scene->addPixmap(QPixmap(fileName));
m_View->setScene(m_Scene);
How I can show .gif animation in the same scene?
...
This might have been asked a million times before or might be incredibly stupid but why is it not implemented?
class A
{
public:
A(){ a = 5;}
int a;
};
class B:public A
{
public:
B(){ a = 0.5;}
float a;
};
int main()
{
A * a = new B();
cout<<a->a;
getch();
...
I wrote program to convert decimal to binary for practice purposes but i get some strange output. When doing modulo with decimal number, i get correct value but what goes in array is forward slash? I am using char array for being able to just use output with cout <<.
// web binary converter: http://mistupid.com/computers/binaryconv.htm
...
I went over making my own copy constructor and it overall makes sense to me. However, on the topic of doing your own assignment operator I need someone to fill in the blank for me.
I pretty much don't get why you are returning *this in all the examples, such as the one below:
Foo & Foo::operator=(const Foo & f)
{
//some logic
return...
There are two ways in which I can easily make a key,value attribution in C++ STL: maps and sets of pairs. For instance, I might have
map<key_class,value_class>
or
set<pair<key_class,value_class> >
In terms of algorithm complexity and coding style, what are the differences between these usages?
...
May I know whether C++ or PHP is more efficient on running PCA (Principal Component Analysis)?
I'm developing a web based system which get uploaded image with php, and then process the image so that I can analyse the image with PCA to find out whether the image match with another image which already stored in database.
But I'm wonderin...
Is this good practice? Or should I just replace the code block between { and } with a function? It could be reusable (I admit) but my only motivation for doing this is to deallocate colsum since it's huge and not required so that I can free the allocated memory.
vector<double> C;
{
vector<double> colsum;
A.col_sum(colsum);
C = A...
I'm looking for a storage library for storing data in flash memory in an embedded system. I'm on the verge of writing a custom one for want of a format with the right mix of features and simplicity.
Ideally it would be a format and C/C++ library with something better than storing raw structures, but less complex than a full blown file s...
Hi stackoverflow,
I'm having trouble getting boost::iostreams's zlib filter to ignore gzip headers ... It seems that setting zlib_param's default_noheader to true and then calling zlib_decompressor() produces the 'data_error' error (incorrect header check). This tells me zlib is still expecting to find headers.
Has anyone gotten boost::...
I am trying to implement an own OpenID endpoint based on SMF user accounts. I based my code on phpMyOpenID and some SMF authorization code.
It works fine so far. I can use the endpoint to login/register on any site. If I am not logged in on the SMF, it will ask for my login and if that SMF login is successful, it accepts it.
However, i...
It is said that Java overcomes all disadvantages of C++
Disadvantages of C++:
Does not provide very strong type-checking. c++ code is easily
prone to errors related to data types,
their conversions, for example, while
passing arguments to functions.
Does not provide efficient means for garbage collection, as alrea...