Here is the code (also at http://pastebin.com/yw5z2hnG ):
#include <iostream>
#include <vector>
using namespace std;
class X
{
public:
int i;
X();
~X();
};
X::X()
{
i = 1;
cout << "---constructor" << '\n';
}
X::~X()
{
cout << "***desctructor" << '\n';
}
int main()
{
vector<X> *vx = new vector<X>;
...
During the Compiler Design Lab hours, I'm using JLex as the Lexical Analyzer Generator, which produces a Java program from a lexical specification.
I'd like to know if there are other tools which can help me in the same by generating C/C++/C# or VB programs instead of a Java program, and can run in Windows.
...
So if I want to read some information at the offset 00A2E63C (e.g.)...
and I need to have it as a DWORD,
how can I convert the "00A2E63C" String to a proper DWORD?
help is appreciated
...
Hi dudes, i have the following code snippets:
namespace X86X64
{
struct IMM8 {};
}
namespace X86
{
using namespace X86X64;
struct RM8 {};
template <class _Traits>
struct MOV_Instruction
{
typedef typename _Traits::RM8 RM8;
void mov(const RM8& rm, const IMM8& imm)
{}
};
}
namespace ...
On a Linux platform, I have C++ code that goes like this:
// ...
std::string myDir;
myDir = argv[1]; // myDir is initialized using user input from the command line.
std::string command;
command = "mkdir " + myDir;
if (system(command.c_str()) != 0) {
return 1;
}
// continue....
Is passing user input to a system() call safe at all? ...
the BADA IDE is executing the commands
cs-make all 'Building file:
../src/AnimationApp.cpp' 'Invoking:
bada C++ Compiler' i686-mingw32-g++
-D_DEBUG -DSHP -DBUILD_DLL -I"C:/bada/1.0.0b3/include" -I"C:/bada/1.0.0b3/IDE/workspace2/AnimationApp/inc" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/AnimationApp.d" -MT"src/Anim...
Hi everyone, rookie C++ programmer here still.
I'm using VC++ VS2008 compiler and glut library. All working fine and up to date ( I know there's 2010 just cba because of XNA (C#) support reasons)
Ok this time I have a question that is code related but I can make the code work. What I can not do is figure out what is happening under th...
Upon discovering that SDL and X11 use the same keyboard key IDs (I think they're called keysyms), I wanted to use these codes. However, I don't know them and I don't want to just use their defines as I don't want to include stuff as I'm writing a library and don't want to rely on either X11 or SDL as I may just be using X11 or just SDL. ...
$5.6/4 in C++03 states- "If both
operands are nonnegative then the
remainder is nonnegative;if not, the
sign of the remainder is
implementation-defined74).
where Note 74 is
According to work underway toward the
revision of ISO C, the preferred
algorithm for integer division
follows the rules defined inthe ISO
F...
#include<stdio.h>
int fun(int, int);
typedef int (*pf) (int, int);
int proc(pf, int, int);
int main()
{
printf("%d\n", proc(fun, 6, 6));
return 0;
}
int fun(int a, int b)
{
return (a==b);
}
int proc(pf p, int a, int b)
{
return ((*p)(a, b));
}
// direct link of program : http://codepad.org/fBIPiHGT
...
is there any windows api that can send mail using smtp along with attachment.
I have heard its not possible,and i have to use other socket methods,if its true how can I do that??
please suggest c++ or c solution only,no c# or java(like system.net.mail etc)
...
Given 2 functions Translate(x,y) and Scale(x), I want the camera's position to always be the center of the screen. There is also a scalefactor variable and by modifying it it either zooms in or out from the center of the screen. Given that I know the dimensions of the screen in pixels, how could I achieve this? Thanks
...
i am a c coder, new to c++.
i try to print the following with cout with strange output. Any comment on this behaviour is appreciated.
#include<iostream>
using namespace std;
int main()
{
unsigned char x = 0xff;
cout << "Value of x " << hex<<x<<" hexadecimal"<<endl;
printf(" Value of x %x by printf", x);
}
...
I'm generating automatic C++ code from python, in particular I need to select some events for a list of events. I declare some selections:
selectionA = Selection(name="selectionA", formula="A>10")
selectionB = Selection(name="selectionB", formula="cobject->f()>50")
selectionC = selectionA * selectionB # * means AND
this generate the C...
I have to store the number 600851475143 in my program. I tried to store it in long long int variable and long double as well but on compiling it shows the error "integer constant is too large for "long" type.". I have also tried unsigned long long int too. I m using MinGW 5.1.6 for running g++ on windows. What datatype should I use o sto...
Hey... As in a recent question (nobody did react on the last changes) I have a problem with assigning a sockaddr structure filled by recvfrom.
As I have been advised , I did change my sockaddr to sockaddr_storage and casted it in the last moment to be sure of having enough space for the address...
But the problem of
sockaddr_storage ...
Possible Duplicate:
What's the use of metaprogramming?
I know that in C++, there are libraries providing metaprogramming facitlities, like Boost MPL.
But are they really useful in real-world C++ projects ( or just used in rare situations ) ? ( I have the feeling that metaprogramming code are weird and can generate hard-to-deb...
i have ubuntu 10.04 version and install Qt library when i run following code
#include <QDir>
#include <QFileInfo>
#include <QtDebug>
int main( int argc, char **argv )
{
foreach( QFileInfo drive, QDir::drives() )
{
qDebug() << "Drive: " << drive.absolutePath();
QDir dir = drive.dir();
dir.setFilter( QDir::Dirs ); ...
Hi,
I have two processes which are communicating over a pair of sockets created with socketpair() and SOCK_SEQPACKET. Like this:
int ipc_sockets[2];
socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, ipc_sockets);
As I understand it, I should see MSG_EOR in the msg_flags member of "struct msghdr" when receiving a SOCK_SEQPACKET record. I am set...
I am a bit puzzled reading this: Gcc 4.5 online manual --- Standards section.
They explain this
The original ISO C++ standard was published as the ISO standard (ISO/IEC 14882:1998) and amended by a Technical Corrigenda published in 2003 (ISO/IEC 14882:2003). These standards are referred to as C++98 and C++03, respectively. GCC imple...