My input file is:
2 5 <-- extra space at the end
4 <--extra space at the end
int main(){
ifstream input("input.txt");
istream& in = input;
string line1;
while( getline(in,line1)){
istringstream number1(line1);
while(number1.good()){
number1 >> temp1;
cout<<temp1<<endl;
}...
Does virtual memory of process can have different size on different machines (CPU, memory)?
The process does the same job on both machines.
The platform is RHEL 5.3 (kernel 2.6.18) and the process is C++ compiled by gcc (4.1.2).
...
Okay, so at first when i run my win32 program the menu works fine, however when i open the application later the next day or such the menu is gone but the code never changed. im making the menu with a .rc file. is this the recommended way?
resource.rc
#include "resource.h"
IDR_MYMENU MENU
BEGIN
POPUP "&File"
BEGIN
M...
I have a char* name which is a string representation of the short I want, such as "15" and need to output this as unsigned short unitId to a binary file. This cast must also be cross-platform compatible.
Is this the correct cast: unitId = unsigned short(temp);
Please note that I am at an beginner level in understanding binary.
...
Possible Duplicate:
Do the parentheses after the type name make a difference with new?
Hi!
What is the difference between the follow statements?
AnyClass *i1 = new AnyClass();
AnyClass *i2 = new AnyClass;
Both statements compile and run equally.
Is there no difference?
...
Please consider the following code:
class Abase{};
class A1:public Abase{};
class A2:public A1{};
//etc
class Bbase{
public:
virtual void f(Abase* a);
virtual void f(A1* a);
virtual void f(A2* a);
};
class B1:public Bbase{
public:
void f(A1* a);
};
class B2:public Bbase{
public:
void f(A2...
I need to return a unsigned int* from a function. The code below will compile but will crash at run time on a Windows 64 bit machine. I know I am making a silly mistake somewhere and can someone point it out for me. :p. I also have declared the function in my header, so I know its not that error.
Please note I have censored the variable...
Hi,
I'm using CentOS 5.4 x86_64 and Boost 1.42.0 on a cluster that uses Open-MPI 1.3.3. I'm writing a shared library that uses shared memory to store large amounts of data for multiple processes to use. There's also a loader application that will read in the data from the files and load them into the shared memory.
When I run the l...
I want to copy and paste a C function I found in another program into my C++ program.
One of the function arguments uses the "this" pointer.
void cfunction( FILE *outfilefd, const VARTYPEDEFINED this);
The C++ compiler errors here on the function prototype:
error C2143: syntax error : missing ')' before 'this'
How do I make this...
I'm having a lot of trouble getting my compiled assembly file working on SPIM. Basically I want to write a c++ file, and then generate a .s file that I can open in SPIM without error. This means that the assembly must be in MIPS32 ABI using MIPS I instructions (some MIPS II). How do I do this? Right now I'm using g++ but I'm having m...
What are the things that I should keep in mind to write portable code? Since I'm a c++ beginner, I want to practice it since beginning.
Thanks.
...
I'm looking to "hot plug" a library of C++ code. I'm interested in having this technique work cross platform between Linux/Mac/Windows. Basically I want to have the main program #include "StateMachine.h" which defines all callable interfaces. Then at runtime and DURING EXECUTION load and unload StateMachineLibrary.a to have my applica...
Hi everyone. I need some help in writing a macro for 'if-condition' which compiles only when a DEBUG flag is defined by the #define directive.
Here is an example which illustrates what I want. first piece of code shows the usual way of writing an if condition with a #ifdef.
#ifdef DEBUG
if( rv == false )
{
string errorStr = "error...
I'm adding XSLT support to one of our products in the last few weeks. To do that, I've been experimenting with using the microsoft MSXML libraries to transform the XML and XSL files.
Parsing with MSXML basically works, but I've run into a couple of places where it won't support certain things that XSL should allow. This makes me worry t...
Hi,
I have c++ generated executable in solaris 8. the problem i am having is that this executable uses a cmd line param to run.
for example,
$ myprog 123412341234AB
this is a valid 14 digit hexdecimal value. however, if for some reason there are symbols like ^ > < >> << & etc then the program does not behave properly per say. i ...
I have a C# program that I compile with all of the default settings on an x64 computer.
I want to p/invoke a DLL which I know is a 32-bit (unmanaged) C++ DLL.
I can get this to work when my C# program runs on a 32-bit machine, but not a 64-bit machine.
How can I specify in the DllImport call that I am calling into a 32-bit dll?
Exam...
i write this code but it gives an error. why it does not include the header file?
coding:
#include "BitmapEx.h"
CBitmapEx bitmapEx;
bitmapEx.Load(_T("Enter bitmap source file path here..."));
bitmapEx.Rotate(45);
bitmapEx.Sepia();
bitmapEx.Scale(50, 50);
bitmapEx.Draw(hDC);
bitmapEx.Save(_T("Enter bitmap destination file path here...")...
So,
I've got this code I'm trying to update. It was written for visual studio 6, and I'm trying to get it to compile in visual studio 2010.
In stdafx.h, it includes afx.h and afxwin.h and a few other things necessary for the program to work. Notably, there's usage of CString in other header files.
At the top of the includes in stdafx...
I want to know the space complexities of the basic data structures in popular languages.
...
Given two classes:
First class performs AES encryption / decryption and returns encrypted / decrypted data given a certain key and chain.
Second class gathers data to be encrypted and then passes it to the encryption / decryption class.
Is it proper design to call directly the encryption class from the class that gathers the data or s...