I have an Objective-C/C++ application which uses functionality that is provided by a C++ library.
One of the C++ classes includes an enum like this:
class TheClass
{
public:
[...]
enum TheEnum
{
YES,
NO,
};
[...]
};
Including (using #import -if that matters-) a header file with the above class declaration in an Objective-C/...
Possible Duplicate:
Regular cast vs. static_cast vs. dynamic_cast
I don't quite get when to use static cast and when dynamic. Any explanation please?
...
I am busy writing something to test the read speeds for disk IO on Linux.
At the moment I have something like this to read the files:
Edited to change code to this:
const int segsize = 1048576;
char buffer[segsize];
ifstream file;
file.open(sFile.c_str());
while(file.readsome(buffer,segsize)) {}
For foo.dat, which is 150GB...
I want to designate a callback for UDP port such that every time a new packet arrives, a handler is called for it.
I know about using fcntl() to cause file descriptors to raise SIGIO, but let's say things aren't quite that simple. I have an object A with socket a and an object B with socket b. Socket a receives a new packet, and the...
I have a Qt Application and I use qDebug message for my application.
However I have gotten lazy and left in a load of:
#include <QDebug>
in my header files. Should I remove them for a production deployment and what benefit will it give?
...
Hey, I'm doing sockets programming. Pretty much new to it.
The application is a Windows Service, in its ServiceMain() function I call CAsyncSocket's Listen() method, to listen for client connections. But after it starts listening for connections, it'll return and the ServiceMain() function will return and the service is stopped.
What I...
Hi ...
some of you may know the Java Almanac : http://www.exampledepot.com/ where a lot of code snippets exist for a day-to-day use.(like reading a file etc.)
I'm currently using C++ and i was just curios if there exists something similar ?
...
Hi
I have a TBuf variable in my code that looks as follows:
TBuf<100> test;
test.Copy( _L("02somestringofrandomlength"));
What I would like to do now, is to ignore the number (which takes the first two characters).
Is there a nice way to extract the variable-length string from the test variable and thereby dismissing the number at th...
I'm supposed to write a library in c++ that should handle the connections to the kad network.
I'm trying to build a packet accordant to those used by aMule&co.
And I really can't understand the difference between this code:
buffer = "\xe4\x20\x02";
and, for example, this code:
char p_buffer[36];
p_buffer[0] = 0xe4;
p_buffer[1] = 0x2...
A popular feature in many applications - dimming a screen around a modal dialog.
I need to implement this feature on Windows Mobile, C++.
The main wnd is fullscreen, but contains many subwindows. How can everything be dimmed around specific rectangle(bounding required modal window) ?
...
Is there a documentation available for g_io_channel_win32_make_pollfd
I want to use this function to create FDs on windows for IPC between main thread and the separate thread.
It is only briefly mentioned here and doesn't really explain how to use it. I really need an example. thx
...
I have an existing std::string and an int. I'd like to append the int to the string, but in human readable form (hex notation), rather than in binary gibberish.
Normally, I'd just use printf, but I can't do this with a std:: string (can I?)
Any suggestions as to how to do this?
Example:
Given:
std::string - "Your
Id Number i...
I have these two methods for thread-exclusive access to a CMyBuffer object:
Header:
class CSomeClass
{
//...
public:
CMyBuffer & LockBuffer();
void ReleaseBuffer();
private:
CMyBuffer m_buffer;
CCriticalSection m_bufferLock;
//...
}
Implementation:
CMyBuffer & CSomeClass::LockBuffer()
{
m_bufferLock.Lock();
...
Hi to all!
Assuming I have this class in C++:
class A
{
public:
static const TDouble pi_d;
static const TDouble pi;
static const TDouble div;
};
They are initialized at the .h file in the following way:
const TDouble A::pi_d = 3.14;
const TDouble A::pi = A::pi_d;
const TDouble A::div = A::pi / 180.0;
When I print the...
I am using Microsoft Visual Studio 2008, and successfully building a command-line program in C++.
However, for my automated build I call cl.exe and link.exe outside the context of MSVC (I build using Maven Native, as most of the project is Java).
In that case, I manage to generate my executable. But when I execute it, I get the message...
I'm working on a plugin framework, which supports multiple variants of a base plugin class CPlugin : IPlugin. I am using a boost::shared_ptr<IPlugin> for all reference to the plugins, except when a subsystem needs the plugin type's specific interface. I also need the ability to clone a plugin into another seprate object. This must return...
Hello,
i am having problems integrating ITK - Insight Toolkit into another image processing pipeline. ITK itself is a medical image processing toolkit and uses cmake as build system. My image pipeline project uses cmake as well. According to the user manual of ITK it is favorable to use the "UseITK.cmake" file in the build (out of sourc...
what is good practice for generating verbose output? currently, i have a function
bool verbose;
int setVerbose(bool v)
{
errormsg = "";
verbose = v;
if (verbose == v)
return 0;
else
return -1;
}
and whenever i want to generate output, i do something like
if (debug)
std::cout << "deleting interp" << std:...
I am trying to use boost string algorithms for case insensitive search.
total newbie here.
if I am using it this way, I get an error.
std::string str1("Hello world");
std::string str2("hello");
if ( boost::ifind_first(str1, str2) ) some code;
Converting to char pointers resolves the problem.
boost::ifind_first( (char*)str1.c_str(), ...
I have in a VS2005 C++ Form application a table adapter and a Text box that displays data from a specific column. What I want to do is to have its color changed on whether the content is >0 or <0. I tried adding this:
if(this->CSumTextBox->TabIndex<0)
{
this->CSumTextBox->ForeColor = System::Drawing::Color::Red;
}
But it doesn't ...