Hi everyone,
is there any way to automatically use correct EOL character depending on the OS used?
I was thinking of something like std::eol?
I know that it is very easy to use preprocessor directives but curious if that is already available.
EDIT
What I am interested in is that I usually have some messages in my applications that I...
I mean,does makefile search some default directories that is not specified explicitly?
...
I am starting with c++ and need to know, what should be the approach to copy one hashtable to another hashtable in C++?
We can easily do this in java using: HashMap copyOfOriginal=new HashMap(original);
But what about C++? How should I go about it?
UPDATE
Well, I am doing it at a very basic level,perhaps the java example was a wrong ...
Problem:
I am using a big C/C++ code base which works on gcc & visual studio compilers where enum base type is by default 32-bit(integer type).
This code also has lots of inline + embedded assembly which treats enum as integer type and enum data is used as 32-bit flags in many cases.
When compiled this code with realview ARM RVCT 2.2 ...
Hi, I have this class:
class IShaderParam{
public:
std::string name_value;
};
template<class TParam>
class TShaderParam:public IShaderParam{
public:
void (TShaderParam::*send_to_shader)( const TParam
TShaderParam():send_to_shader(NULL){}
TParam value;
void up_to_shader();
};
typedef TShaderParam<float> FloatShaderParam;
typedef ...
I'm investigating smart pointers with "shared" functionality for Windows CE and Mobile, where the VS 2008 tr1 std::shared_ptr cannot be used (due to linkage to a v.9 dll not present on CE, obviously, if I understand it correctly).
There's a semi-old MSDN Magazine article with sources from a Microsoftie (Eric Niebler): Achieve More Relia...
Sorry if the question isn't correct, I'm very new in Objective-C.
I understand why this code throw the Warning: "warning: passing argument 1 of 'initWithObjectsAndKeys:' makes pointer from integer without"
NSDictionary *dictNames =
[[NSDictionary alloc] initWithObjectsAndKeys:
3, @"",
4, @"",
5, @"",nil];
Keys and Value...
I have a simple cpp file which uses GIO. I have stripped out everything to show my compile error:
Here is the error I get:
My.cpp:16: error: invalid conversion from ‘int’ to ‘GIOCondition’
make[2]: *** [My.o] Error 1
Here is the complete file:
#include <glib.h>
static gboolean
read_socket (GIOChannel *gio, GIOCondition condition, g...
I'm trying to use an instant of a custom class as a template parameter.
class X {
public:
X() {};
};
template <class Foo, Foo foo>
struct Bar {
};
const X x;
Bar<X, x> foo;
The compiler states that x cannot appear in a constant expression. Why that? There is everything given to construct that object at compile time.
...
I want to do something like that:
for (v=1;v=150;v++) {
for (h=1; h=250;v++) {
tile_0%i_0%i.image = [UIImage imageWithData:tmp_content_of_tile]; //1st %i = v; 2nd %i = h
}
}
In the %i should be inserted the current value of "v" or "h"? Is it possible? How is it called?
Greets!
...
After some struggling I managed to get boost smart pointers to build for Windows CE/Mobile at warning level 4.
I found the least-resistance-way to get rid of compile errors and warnings to be
#define BOOST_NO_MEMBER_TEMPLATES
What does it actually mean? Did I sell my soul to the devil? Will all hell break loose when I actually use th...
Hi, I am trying to get the HWND and ThreadID for currently Focussed Window.
Usually GetForegroundWindow() and then then calling GetThreadProcessId() gives me the correct information.
But in Case of IE8 the HWnd the GetForegroundwindow() gives me the HWND of the IE Frame but actually the focussed window (the document object or Internet ...
I've created a managed COM object with related TLB file in VS2005. If I import the dll in a C++ source file, I can use the interface. However, I want to import the TLB in the header file, because I want to make a global object of an interface object.
Now I have the following code (at the very top of the file) in the cpp file:
#include ...
I always catch exceptions by value. e.g
try{
...
}
catch(CustomException e){
...
}
But I came across some code that instead had catch(CustomException &e) instead. Is this a)fine b)wrong c)a grey area?
...
The one advantage of using class T in c++ is to reduce the time to redefine data types in a function, if those data types are defined in other function, for example, in int main.
template <class T>
void showabs(T number)
{
if (number < 0 )
number = -number;
cout << number << endl;
return 0;
}
int main()
{
int num1 = -4;
...
I am looking for a main memory database with a C++ interface. I am looking for a database with a programmatic query interface and preferably one that works with native C++ types. SQLLite, for example, takes queries as string and needs to perform parsing ... which is time consuming. The operations I am looking for are:
Creation of table...
I tried [NSString stringWithUTF8String:(const char*)(myWString.c_str())] but that returns a single character string.
This is on the iPhone by the way, if that matters any :)
...
In the boost::shared_ptr destructor, this is done:
if(--*pn == 0)
{
boost::checked_delete(px);
delete pn;
}
where pn is a pointer to the reference counter, which is typedefed as
shared_ptr::count_type -> detail::atomic_count -> long
I would have expected the long to be volatile long, given threaded usage and the non-atomic ...
I am filtering the HKEYS by using Hook filtering function, I use the following code to disable Alt+Tab, Alt+Esc, Ctrl+Esc, Windows Key
if (((lParam.vkCode == 9) && (lParam.flags == 32))||
((lParam.vkCode == 27) && (lParam.flags == 32))||
((lParam.vkCode == 27) && (lParam.flags == 0)) ||
((lParam.vkCode == 91) && (lParam....
hi... i'm writing a code to receive password input. Below is my code... the program run well but the problem is other keys beside than numerical and alphabet characters also being read, for example delete, insert, and etc. can i know how can i avoid it? tq...
string pw="";
char c=' ';
while(c != 13) //Loop until 'Enter' is pressed
{
...