Hello all,
I am starting to learn everything about security and secure programming.
I have always heard about things like buffer overflow vulnerability.
But I don't know yet how such vulnerabilities are exploited.
And how can we program securely enough to make sure that our code is robust.
When I say all this, my programming language...
Say I have a QHBoxLayout where there are 2 QTextEdits and between them a button with an arrow to the right. So when you click on the button, the right-side QTextEdit gradually closes by moving the lift borther untill it meats the right one. Simulutaniously, the right border of the left QTextEdit thakes the place which the right QTextEdit...
The following code compiles and runs perfectly,
#include <iostream>
class sam {
public:
void func1();
int func2();
};
int main() {
sam s;
}
Should it not produce a error for the lack of class member definition?
...
What's wrong here?
#include <memory>
#include <vector>
int main()
{
std::vector<std::unique_ptr<int>> vec;
int x(1);
std::unique_ptr<int> ptr2x(&x);
vec.push_back(ptr2x); //This tiny command has a vicious error.
return 0;
}
The error:
$ g++ -std=gnu++0x main.cpp
In file included from c:\mingw\bin\../lib/gcc/min...
Hey folks,
I need some way in c++ to keep track of the number of milliseconds since program execution. And I need the precision to be in milliseconds. (In my googling, I've found lots of folks that said to include time.h and then multiply the output of time() by 1000 ... this won't work.)
...
I'm working on a project that already contains the gzip library as follows:
zlib\zlib.h
zlib\zlib.lib
zlib\zconf.h
I would like to use the gzip functions from this .lib but am getting the following errors:
Compress.cpp
Linking...
Compress.obj : error LNK2001: unresolved external symbol _gzclose
Compress.obj : error LNK2001: unr...
i know that is somehow near to question
http://stackoverflow.com/questions/3283060/question-about-command-line
but here i will be more deeply
so my project name of which is project3 is keeped at desktop like project3.txt
how compile it from command line?please give me command for to do it and also if it will be usefull for you in code...
This is like the question
http://stackoverflow.com/questions/153748/webbrowser-control-from-net-how-to-inject-javascript
But i don't know how to transform this code into good old MFC C++ code.
For example what is the InvokeScript method, i can't find it anywhere.
Isn't .NET webbrowser the same as IWebBrowser2 ?
...
First of all, I don't have multiplication, division operations so i could use shifting/adding, overflow-multiplication, precalculations etc. I'm just comparing one n-bit binary number to another, but according to algorithm the quantity of such operations seems to be huge. Here it is :
There is given a sequence of 0's and 1's that is di...
Possible Duplicate:
The Definitive C++ Book Guide and List
Can somebody recommend me advance c++ book explaining RAII, autoptrs?
Thank you
...
struct WeatherStation {
string Name;
double Temperature;
};
void Initialize(WeatherStation[]);
void HL(WeatherStation List[]);
int main()
{
string Command;
WeatherStation Stations[5];
//some commands
}
void Initialize(WeatherStation StationList[])
{
StationList[0].Name = "A";
StationList[0].Temperature = 0.0;
...
I'm working on a game engine and I'm too much of a wuss to write image loaders for multiple formats, so my question is this: Is there an abstracted image loading library to load image files? I just need to load files then splat them on to the screen using an array of pixels.
...
In C++, how can I remove a directory with all its contained files? I know there is rmdir, but it will only remove non-empty directories, so how do I list and remove all contained files first?
I know it shouldn't be hard using Boost Filesystem, but I kind of want to avoid building and depending on it just for this one little task ...
...
I have a class called Foo with a constructor that needs arguments, and a other class Bar with a Foo private variable
class Foo
{
public:
Foo(string);
}
class Bar
{
public:
Bar() { this->foo = Foo("test") }
private:
Foo foo;
}
However, when I try to compile this, I get a compile error that t...
So I'm about finishing up prata's C++ primer and I'm u to RTTI. He showed a line of downcasting and just said it's wrong but I want to see a better example.
class Grand
{
private:
int hold;
public:
Grand(int h=0) : hold(h) {}
virtual void Speak() const { cout << "I am a grand class\n";}
virtual int Value() const {return...
I have a class that should hold a reference to some data, without owning that data (i.e. the actual data is guaranteed not to go out of scope). In particular, the class cannot make a copy – the data is easily several gigabytes in size.
Now, the usual implementation (I assume) is to have a reference to the data:
struct holder_ref {
...
I have a std::list of Bananas, and I want to get rid of the bad ones. Is there any relatively simple way to perform the following pseudocode?
foreach(Banana banana in bananaList)
{
if(banana.isBad()) bananaList.remove(banana);
}
(Making a transition from C# and Java to C++ has been a rocky road.)
...
Hi,
I want to specialize operator<< but this code is not compiling;
template<>
std::ostream& operator<< < my_type >( std::ostream& strm, my_type obj);
...
I'm trying to write a simple TGA image file saver as a learning exercise in C++. I'm basing my code on an example TGA loader that declares a struct for the header and then uses fread() to load the entire header in one go.
My program isn't working right now, and it seems like there are two extra bytes being written to the file. I printed...
I have a remote server which handles various different commands, one of which is an event fetching method.
The event fetch returns right away if there is 1 or more events listed in the queue ready for processing. If the event queue is empty, this method does not return until a timeout of a few seconds. This way I don't run into any HTTP...