when a C++ program reads from cin, the ddd provides it with "1" instead of letting me type the input in its console. Since the program reads interactive commands, "1" is an invalid command and ddd seems to have an infinite supply of them, the result is an infinite loop of "invalid command" output.
Have anybody encountered such behavior ...
Hi,
Is it possible to call a native CPP function using JNI which takes generic arguments? Something like the following:
public static native <T, U, V> T foo(U u, V v);
And then call it like:
//class Foo, class Bar, class Baz are already defined;
Foo f = foo(new Bar(), new Baz());
Can anyone please provide me with a sample which is...
I wanted to shrink the size of a large text file with float values into a binary .dat file, so I used (in c++):
// the text stream
std::ifstream fin(sourceFile);
// the binary output stream
std::ofstream out(destinationFile, std::ios::binary);
float val;
while(!fin.eof())
{
fin >> val;
out.write((char *)&val,sizeof(float))...
I am trying to use the Microsoft 'Crypt...' functions to generate an MD5 hash key from the data that is added to the hash object. I am also trying to use the 'CryptSetHashParam' to set the hash object to a particular hash value before adding data to it.
According to the Microsoft documentation (if I am interpreting it correctly), you s...
Hi
For example we have code
class MyClass
{
private:
int data;
public:
int getData()
{
return data;
}
};
int main()
{
MyClass A, B, C;
return 0;
}
Since A, B and C are objects of MyClass, all have their own memory.
My question is that, are all of these objects share same memory for methods of class ( get...
This is related to my other post. One of the suggestions here was to use vector for class Region.. as illustrated in the following code. I have a few more beginner questions --
a) How to allocate this vector a size = numOfRegions? Or do I really need to allocate a size to a vector?
b) How do I insert objects of class Region to this v...
Hi,
currently I'm fixing some issues regarding to small outputted dll (I'm using Ribosome build system on Windows) so I'm wondering this:
suppose project (C++) include source files whose total size is i.e. 100 KB and project also depends on i.e. 3 libraries, each about 100KB, what binary size should I expect after compiling and linking...
In VC++7 if I do the following:
void myTerminate()
{
cout << "In myTerminate()";
abort();
}
int main( int, char** )
{
set_terminate( &myTerminate );
set_terminate( 0 );
terminate();
return 0;
}
the program behaves exactly as if abort() was called directly which is exactly what default terminate() handler does....
when i am including (#include in visual studio 2005) this headerfile it is showing the error as (fatal error C1083: Cannot open include file: 'dirent.h': No such file or directory)
i am new to C++ can anyone please provide me the solution for this error?
...
I have an Array with some values e.g
A=[a,b,c];
What would be the easiest/fastest way in c++ to calculate the following:
int SUM;
SUM= a*b + a*c + b*a + b*c + c*a + c*b;
In this case a*c != c*a
In the real case i have differently sized big arrays and will take the values for a,b & c from other arrays.
/thanks in Advance
...
I have class which handles packages:
typedef void (*FCPackageHandlerFunction)(FCPackage*);
class FCPackageHandlers{
...
void registerHandler(FCPackage::Type type, FCPackageHandlerFunction handler);
void handle(FCPackage* package);
...
QHash<FCPackage::Type, FCPackageHandlerFunction> _handlers;
};
Then I have a serv...
How can I use tr1::function with WINAPI calling convention ? (at least in windows). I can use visual c++ 9 SP1 TR1 or BOOST's one...
typedef void (WINAPI *GetNativeSystemInfoPtr)(LPSYSTEM_INFO);
HMODULE h = LoadLibrary (_T("Kernel32.dll"));
GetNativeSystemInfoPtr fp = (GetNativeSystemInfoPtr) GetProcAddress (h,"GetNativeSystemInfo");
SY...
As I understand it, what makes dynamic cast different from a static cast is its use of RTTI, and the fact that it fails if the dynamic type of a variable- when casting from base to derived- does not fit. But why does the class have to be polymorphic for that to be done if we have the RTTI anyway?
EDIT: Since there was some confusion abo...
Hi,
I cannot get a proper theme for toolbars in Vista / 7 with wxWidgets (c++). For some unknown reason, I get gray bar now (as you can see here). I want it to get this look instead. I've linked against comctl32.lib (=> 5.82) and UXTHEME is on. Here's the code:
#include <wx/wx.h>
class TestAppFrame: public wxFrame
{
public:
...
Develop a C program for file-copy where two processes work together to complete the task:
Parent process receives source filename and destination filename from command line. It opens the source file in read mode.
Use shared lock on the source file in both the processes. Use exclusive lock on the destination file. Do read/write operatio...
Background
I am designing an application which will convert text from one language to other. For example, input text hello will be converted to specified language text. This is done by having a lookup table for each language. Conversion algorithm has the following steps.
Looks for exact match. The whole word hello will be the pattern....
Hi,
I recently started "playing" with xpcom, and I would like to know if there is a way
do interact with a Shockwave flash element.
In IE I can use the IShockwaveFlash interface, but for the Firefox I can't find any interface.
I tried using the nsIFlash5 definition from the header file "wrap_XPCOM_3rdparty.h" (acquired from the XulRun...
i'm trying to create a map of word==>drow, like polindrom...
the problem is at the final level at "strtok"...
first i split it, then in subsequent call when doing strtok(NULL," "); it works ok.
the problem is when i add the second string "poly_buffer"... seems it works on it....
#include "stdafx.h"
#include <iostream>
#include <cstdio>
...
Hello,
I have a QCompleter that is forcing my users to hit enter twice when the popup is visible but is not used to select an item. The model for the QComboBox associated to the completed is used as the model for the completer.
QCompleter *completer = new QCompleter(this);
completer->setCaseSensitivity(Qt::CaseInsensitive);
comple...
I love declaring variables on the stack, especially when using the standard container. Each time you avoir a new, you avoid a potential memory leak.
I also like using polymorphism, ie class hierarchies with virtual functions. However, it seems these features are a bit incompatible: you can't do:
std::vector<BaseType> vec;
vec.push_back...