The question is how function-level statics are constructed when the function is called on multiple threads?
Problem Description: Deadlock occurs and my application doesn't get terminated. During initialization of local static variable it tries to acquire MSVCR80!_lock and never gets hold on the lock.
!locks command in WinDbg gives the ...
HEllo , i can not find any way to get horizontal or/and vertical resolution for bitmap.
If you know how to get it, please say it me , Thank you!
...
Why is this not valid
for( int i = 0, int x = 0; some condition; ++i, ++x )
and this is
int i, x;
for( i = 0, x = 0; some condition; ++i, ++x )
Thanks
...
I am writing program in c++ which runs GNU readline in separate thread. When main thread is exited I need to finish the thread in which readline() function is called. The readline() function is returned only when standart input came (enter pressed).
Is there any way to send input to application or explicitly return from readline functio...
I have a variable of type string. I want to check if it contains a certain string. How would I do that?
Is there a function that returns true if the string is found, and false if it isn't?
...
Is there a way to posix_memalign a std::vector without creating a local instance of the vector first?
The problem I'm encountering is that I need to tell posix_memalign how much space to allocate and I don't know how to say
sizeof(std::vector<type>(n))
without actually creating a new vector.
Thanks
...
I have been away from C++ for a couple of years now doing AS3/Flex work. I have gotten used to being able to create a component and place it in design mode with very little fuss and I am struggling to get my head around the C++ Builder way of doing the same thing.
I have written many components for C++ Builder in the past, but none of t...
In C++, I often needed NVI to get consistency in my APIs. I don't see it used as much among others in C#, though. I wonder if that is because C#, as a language, offers features that makes NVI unnecessary? (I still use NVI in C#, though, where needed.)
...
I have set of c++ dlls and a c# exe . My c++ dlls are multi-threaded and they put data into a Database. My c# exe uses Background worker . My c# exe gets these data to a Data table asynchronously. To achieve this I am using named Mutex. My problem is when I assign this Data Table to my grid view It is crashing. I am using delegates and B...
If I have a string, and I want to find if it contains a number of the form XXX-XX-XXX, and return its position in the string, is there an easy way to do that?
XXX-XX-XXX can be any number, such as 259-40-092.
...
Let's say I want to look at the character at position 10 in a string s.
s.at(10);
What would be the easiest way to know if this is a number?
...
I want to make a 2D game in C++ using the Irrlicht engine. In this game, you will control a tiny ship in a cave of some sort. This cave will be created automatically (the game will have random levels) and will look like this:
Suppose I already have the the points of the polygon of the inside of the cave (the white part). How should I ...
I'm trying to read / write multiple Protocol Buffers messages from files, in both C++ and Java. Google suggests writing length prefixes before the messages, but there's no way to do that by default (that I could see).
However, the Java API in version 2.1.0 received a set of "Delimited" I/O functions which apparently do that job:
parse...
Visual C++ has function-level linking. Looks like it's a great thing - it can reduce the size of generated executables.
Does it have any negative effects? Will I have to pay anything for the advantages of this option or can I just turn it on and enjoy the benefits?
...
Is it possible to use Input to call a member function?
void one()
{
}
cout << "enter input:" << endl;
cin >> input; //where input is "one"
instance.input()
...
Hello! Code first:
struct Foo {
char * DataPtr;
};
class ISomeInterface {
public:
Foo GetFoo( ) const;
Foo GetFoo( );
};
The Foo::DataPtr is a pointer to an internal buffer of the object behing ISomeInterface. Is there a way to make sure that the Foo::DataPtr returned by the const version of ISomeInterface::GetFoo is a c...
I'm getting these errors in my program after pasting in some code:
showdata.cpp:66: error: stray ‘\342’ in program
showdata.cpp:66: error: stray ‘\200’ in program
showdata.cpp:66: error: stray ‘\235’ in program
showdata.cpp:66: error: stray ‘\’ in program
showdata.cpp:66: error: stray ‘\342’ in program
showdata.cpp:66: error: stray ‘\20...
I have a map like this:
map<prmNode,vector<prmEdge> > nodo2archi;
In a certain situation, I have to change an object's attribute in a value into the vector of prmEdge. This is the code:
prmNode par=freePathNode[z];
z++;
prmNode arr=freePathNode[z];
map<prmNode,vector<prmEdge> >::iterator it;
it=nodo2archi.find(par);
app.clear();
vec...
I have some .exe name i want to terminate if its running, how?
Edit: I modified mike's example to this, and its perfect:
WinExec("taskkill /IM notepad.exe /F", SW_HIDE);
...
I'm on MacOSX.
In the logger part of my application, I'm dumping data to a file.
suppose I have a globally declared std::ofstream outFile("log");
and in my logging code I have:
outFile << "......." ;
outFile.flush();
Now, suppose my code crashes after the flush() happens; Is the stuff written to outFile before the flush() guarantee...