Hi StackOverflow,
I have an application that is parallellized using pthreads. The application has a iterative routine call and a thread spawn within the rountine (pthread_create and pthread_join) to parallelize the computation intensive section in the routine. When I use an instrumenting tool like PIN to collect the statistics the tool ...
I just wanted to know the difference between . operator and :: operator?
...
What is the effective way to replace all occurrences of a character with another character in std::string?
...
I'm interested in open-source Java/C/C++ framework for pipes-and-filters (like described in that book) paradigm.
Can you recommend some?
EDIT: I'm looking for as much "pure" (or lightweight) frameworks as possible: frameworks which encourage programming in "pipes-and-filters" technique, without reliance on any standards, such as XML or ...
int* p = 0;
int* q = &*p;
Is this undefined behavior or not? I browsed some related questions, but this specific aspect didn't show up.
...
Hello all.
I'm writing a program that among other things needs to download a file given its URL. I'm too lazy to implement the Http/Https protocols manually, so that I needed some library/object/function that'll do the job.
Critical requirement: The download must be asynchronous. That is, the thread that issued the download must be abl...
Hi, I would like to have a windowless OpenGL context (on both GNU/linux with Xorg and Windows). I'm not going to render anything but only call functions like glGetString, glCompileShader and similar.
I've done some goggling but not come up with anything useful, except creating a hidden window; which seems like a hack to me.
So does an...
For example, say I have string like:
duck duck duck duck goose goose goose dog
And I want it to be as sparsely populated as possible, say in this case
duck goose duck goose dog duck goose duck
What sort of algorithm would you recommend? Snippets of code or general pointers would be useful, languages welcome Python, C++ and extra k...
I have a Windows CE console application that's entry point looks like this
int _tmain(int argc, _TCHAR* argv[])
I want to check the contents of argv[1] for "-s" convert argv[2] into an integer. I am having trouble narrowing the arguments or accessing them to test.
I initially tried the following with little success
if (argv[1] ==...
I am getting confused on why the compiler is not recognizing my classes. So I am just going to show you my code and let you guys decide. My error is this
error C2653: 'RenderEngine' : is not a class or namespace name
and it's pointing to this line
std::vector<RenderEngine::rDefaultVertex> m_verts;
Here is the code for rModel, in i...
Hi, i have the following function i wrote to create an XML file using Xerces 3.0.1, if i call this function with a filePath of "foo.xml" or "../foo.xml" it works great, but if i pass in "c:/foo.xml" then i get an exception on this line
XMLFormatTarget *formatTarget = new LocalFileFormatTarget(targetPath);
can someone explain why my co...
I have the following simple code:
ofstream output("test");
output << 'a';
When I do an octal dump of the file, I get this:
0000000 000141
0000001
I can see that 000141 (in base 8) is 8 bits wide and 0000001 is probably EOF.
What is the first byte of all 0's and why is it there? I know it is null is ascii
but what is its purpose?
...
Hi All,
This may be very obvious question, pardon me if so.
I have below code snippet out of my project,
#include <stdio.h>
class X
{
public:
int i;
X() : i(0) {};
};
int main(int argc,char *arv[])
{
X *ptr = new X[10];
unsigned index = 5;
cout<<ptr[index].i<<endl;
return 0;
}
Question
Can I change the meaning of...
i am trying to broadcast a UDP package using subnet.
i want to braodcast my package to 192.168.1.255 ?
can i do that ? and how using c++ ?
...
Hi,
I am just trying to fiddle around what is the best and shortest way to describe two simple instructions with C-like pseudo code. The extract instruction is defined as follows:
extract rd, rs, imm
This instruction extracts the appropriate byte from the 32-bit source register rs and
right justifies it in the destination register. T...
Using VS2008, we would like to simulate a file that has a size of X, but that has a read failure at X-Y bytes, so that we get an error indication.
Anyone have an idea of how to do this on windows? Looks like there is a solution for linux, but I can't really come up with a way to do this on windows. We have multiple developers, multiple...
I am trying to test the crypto library that comes with openssl, I downloaded openssl from http://www.openssl.org/source/ and it contains a /crypto folder with subfolders for each encryption type.
I wanted to try BIO_f_base64 so I created an empty console app, and added the includes needed, also added the paths to the /bio and /evp folde...
I have a legacy C++ "solution engine" that I have already wrapped as an in-process COM object for use by client applications that only require a single "solution engine".
However I now have a client application that requires multiple "solution engines". Unfortunately the underlying legacy code has enough global data, singletons and thre...
Situation is following. I have shared library, which contains class definition -
QueueClass : IClassInterface
{
virtual void LOL() { do some magic}
}
My shared library initialize class member
QueueClass *globalMember = new QueueClass();
My share library export C function which returns pointer to globalMember -
void * getGlobal...
Possible Duplicate:
Whats the Right Way to use the rand() Function in C++?
When I run the below program I always get the same values each time. Is rand not a true random function?
int main()
{
while(1)
{
getch();
cout<<rand()<<endl;
}
}
In each run I am getting the below values.
41
18467
6334
26500
19169
1572...