I am working tools that will be used on the multiple OS and platform. This tools will provide the details of the OS on which it is running, like 32 bit or 64 bit OS, exact version of Linux,Solaris,or other OS.
One way I am thinking of using the "uname -a" command to extract the OS information on the Linus/Unix based OS. Please suggest m...
In C++ we can rotate a point about an arbitrary axis:
void radRotateAxis( float a, float b, float c, float theta )
{
float newX = (
x*( a*a*(1-cos(theta)) + cos(theta) ) +
y*( a*b*(1-cos(theta)) - c*sin(theta) ) +
z*( a*c*(1-cos(theta)) + b*sin(theta) ) );
float newY = (
x*( a*b*(1-cos(theta)) + c...
hi,
i am able to read data during debug time ,but when i perform write and read ,during run time ,i am unable to read data during run time
IssueRead()
{
delete iBuffer1;
iBuffer1 = NULL;
iBuffer1 = HBufC8::NewL(1000);
TPtr8 bufferPtr2(iBuffer1->Des());
iEchoSocket->Recv(bufferPtr2,0,iStatus,iLength);
//iEchoSocket->Re...
A simple test app:
cout << new int[0] << endl;
outputs:
0x876c0b8
So it looks like it works. What does the standard say about this? Is it always legal to "allocate" empty block of memory?
...
Here is my code for finding a sequence in a string and replacing it with another:
std::string find_and_replace( string &source, string find, string replace )
{
size_t j;
for ( ; (j = source.find( find )) != string::npos ; )
{
source.replace( j, find.length(), replace );
}
return source;
}
Everything works fine...
I'm using boost::asio, and I have code like this:
void CServer::Start(int port)
{
tcp::acceptor acceptor(m_IoService, tcp::endpoint(tcp::v4(), port));
for ( ;; )
{
shared_ptr<tcp::socket> pSocket(new tcp::socket(m_IoService));
acceptor.accept(*pSocket);
HandleRequest(pSocket);
}
}
This code works, bu...
The visual studio std::vector visualizer in the VS2008 autoexp.dat file doesn't seem to work if I have a std::vector<boost::variant<...>>. It does work on other types of vectors I have tried (e.g std::vector<int>, std::vector<boost::shared_ptr<..>>)
Here is the visualizer code:
std::vector<*>{
children
(
#array
(
expr : ($e._Myfir...
For the application im building, i use an activex ie control. It works greate but i cant work out how to remove the border around it.
I have tried overriding the invoke call and setting DISPID_BORDERSTYLE to zero but it looks like it never gets hit.
Any ideas?
...
I get the error message "Resource temporarily unavailable" when I use the method receive_from(), it's a member of ip::udp::socket located here.
I pass to it: boost::asio::buffer, pointer to an endpoint object, flags (set to zero), and an error_code object.
I create the endpoint with just
new udp::endpoint()
There doesn't seem to...
Consider the following C++ code:
class A
{
public:
virtual void f()=0;
};
int main()
{
void (A::*f)()=&A::f;
}
If I'd have to guess, I'd say that &A::f in this context would mean "the address of A's implementation of f()", since there is no explicit seperation between pointers to regular member functions and virtual membe...
I'm toying with an application that is, roughly speaking, a sort of modeler application for the building industry. In the future I'd like it to be possible for the user to use both SI units and imperial. From what I understand, it's customary in the US building industry to use fractions of inches when specifying measurements, eg 3 1/2" -...
We have a very large project mostly written in C# that has some small, but important, components written in C++. We target the RTM of .NET 2.0 as the minimum required version. So far, in order to meet this requirement we've made sure to have only the RTM of .NET 2.0 on our build box so that the C++ pieces link against that version.
Upda...
I've just written a method that is called by multiple threads simultaneously and I need to keep track of when all the threads have completed, the code uses this pattern:
private void RunReport()
{
_reportsRunning++;
try
{
//code to run the report
}
finally
{
_reportsRunning--;
}
}
This is the only p...
What's wrong with this:
pVertexBuffer[0].Position = D3DXVECTOR3(0.0f,0.0f,0.0f);
pVertexBuffer[0].TexCoord = D3DXVECTOR2(0.0f,0.0f);
pVertexBuffer[1].Position = D3DXVECTOR3(m_ScreenResolutionX,0.0f,0.0f);
pVertexBuffer[1].TexCoord = D3DXVECTOR2(1.0f,0.0f);
pVertexBuffer[2].Position = D3DXVECTOR3(0.0f,m_ScreenResolutionY,0.0f);
pVertex...
I want to write a function that outputs something to a ostream that's passed in, and return the stream, like this:
std::ostream& MyPrint(int val, std::ostream* out) {
*out << val;
return *out;
}
int main(int argc, char** argv){
std::cout << "Value: " << MyPrint(12, &std::cout) << std::endl;
return 0;
}
It would be conveni...
Hi. I have a question about different versions of an object, their sizes, and allocation. The platform is Solaris 8 (and higher).
Let's say we have programs A, B, and C that all link to a shared library D. Some class is defined in the library D, let's call it 'classD', and assume the size is 100 bytes. Now, we want to add a few members ...
I'm seeing a problem when querying Sybase IQ with a prepared statement. The query works fine when I type the entire query as text and then call PrepareStatement on it with no parameters. But when I stick in one parameter, then I get back errors, even though my sql is correct. Any idea why?
This code works perfectly fine and runs my que...
I'd like the destructor of my class to delete the entire object except for one of the members, which is deleted elsewhere. First of all, is this totally unreasonable? Assuming it's not, how do I do this? I thought that created an destructor with an empty body would prevent all the members from being deleted (because the destructor wou...
If I have a #define statement within a namespace as such:
namespace MyNamespace
{
#define SOME_VALUE 0xDEADBABE
}
Am I correct in saying that the #define statement is not restricted to the namespace?
Is the following the "correct" thing to do?
namespace MyNamespace
{
const unsigned int SOME_VALUE = 0xDEADBABE;
}
...
I want to call a Subversion API from a Visual Studio 2003 C++ project.
I know there are threads here, here, here, and here that tell how to get started with C#.NET on Windows (the consensus seems to be SharpSvn, which I've used easily and successfully on another project) but that's not what I want.
I've read the chapter on using APIs i...