Forum: C++ Jun 14th, 2008 |
| Replies: 5 Views: 463 |
Forum: C++ Jun 14th, 2008 |
| Replies: 17 Views: 731 Re: Semafore in Windows problem When I make vector static, I get unresolved external error.
In meantime I found this:
http://homepages.tesco.net/J.deBoynePollard/FGA/class-function-members-cannot-be-thread-functions.html
Do I... |
Forum: C++ Jun 13th, 2008 |
| Replies: 17 Views: 731 Re: Semafore in Windows problem Ok, it seems I must still learn a lot about windows threading.
I have these threads running, but I need them to use base class method and container. Base to MultiReader (DirectoryReader) have method... |
Forum: C++ Jun 13th, 2008 |
| Replies: 17 Views: 731 Re: Semafore in Windows problem Wow... Thanks for this tip.
I still think of these object in POSIX manner, where (as far as I remember) wait functions do not return untill they acquire semaphore, if timeout was set to infinite.... |
Forum: C++ Jun 13th, 2008 |
| Replies: 17 Views: 731 Re: Semafore in Windows problem I replaced that Mutex with Semaphore object. There should be no much difference, but anyway, this is pretty much my code now:
// MultiReader.h
class MultiReader :
public... |
Forum: C++ Jun 13th, 2008 |
| Replies: 2 Views: 172 Re: Segmentation error If you using C++ (you are posting in C++ forum) you should take advantage of STL library which is part of language now. You should almost always use STL containers and avoid C-style arrays. |
Forum: C++ Jun 13th, 2008 |
| Replies: 7 Views: 939 Re: Using CreateThread() function Everything ok with this function now, I mark this thread as solved and continue being problematic in this thread:
http://www.daniweb.com/forums/thread127041.html |
Forum: C++ Jun 12th, 2008 |
| Replies: 17 Views: 731 Re: Semafore in Windows problem Ok I figured out that static const must be initialize within class body, but still:
class MultiReader :
public DirectoryReader
{
public:
MultiReader(char*... |
Forum: C++ Jun 12th, 2008 |
| Replies: 7 Views: 939 Re: Using CreateThread() function I managed to make compiler accept parameter using &vDirectories.at(nThreadNo) but I missed that litte (void*). Thank you very much, good sir!
Threading almost solved for me. |
Forum: C++ Jun 12th, 2008 |
| Replies: 7 Views: 939 Re: Using CreateThread() function Now I need to do something like this:
CreateThread( NULL, 0, &MultiReader::ReaderThread, (void*)vDirectories.at(nThreadNo), 0, NULL);
While vDirectories is:
struct OPTIONS
{
string... |
Forum: C++ Jun 12th, 2008 |
| Replies: 17 Views: 731 Re: Semafore in Windows problem Ok, I got working threads, but still can't make proper synchronization. It's hard to find good example.
So, there is header file:
class MultiReader :
public... |
Forum: C++ Jun 12th, 2008 |
| Replies: 7 Views: 939 Re: Using CreateThread() function Yep, that's it. I tried to figure it out for days. & was there just because compiler suggested me to put it there. That thing is solved, thank you very much.
Now parameter 4: it should be &adress of... |
Forum: C++ Jun 12th, 2008 |
| Replies: 7 Views: 939 Using CreateThread() function I'm trying to call this function requested times. All functions and variables are members of one class, access is public. So, I'm calling like this:
void MultiReader::CreateThreads()
{
unsigned int... |
Forum: C++ Jun 7th, 2008 |
| Replies: 19 Views: 735 Re: Queues. Help required in project Just one tip: you don't need clock(). You counting virtual time, so you can represent this as integer. It's easier to add and calculate average queue time that way.
Opps sorry Salem already wrote... |
Forum: C++ Jun 7th, 2008 |
| Replies: 8 Views: 528 Re: toupper function #include <cctype> // for toupper()
#include <algorithm> // for transform()
transform(x.begin(), x.end(), x.begin(), toupper);
try this |
Forum: C++ Jun 5th, 2008 |
| Replies: 17 Views: 731 Re: Semafore in Windows problem Yeah sorry I missed point. I'm still thinking about semaptores in POSIX manner - acquired means it's acquired regardless of process accessing it. |
Forum: C++ Jun 5th, 2008 |
| Replies: 17 Views: 731 Re: Semafore in Windows problem I am still stuck with this... It seems bit complicated to fill security attributes and security descriptor structures. Anyone have experience with this? Option is to use MFC, but I'm not familiar... |
Forum: C++ Jun 1st, 2008 |
| Replies: 17 Views: 731 Re: Semafore in Windows problem I'm pretty sure semaphore is not working correctly anyway. There should be no difference between single thread and more threads acquiring semaphore. For example, if I call WaitForSingleObject() twice... |
Forum: C++ May 31st, 2008 |
| Replies: 4 Views: 518 |
Forum: C++ May 31st, 2008 |
| Replies: 3 Views: 359 Re: How to generate random numbers... http://www.google.com/search?hl=pl&q=generating+random+numbers+c%2B%2B&lr=
First result for me is ling to DaniWeb article on generating random numbers. |
Forum: C++ May 31st, 2008 |
| Replies: 17 Views: 731 Semafore in Windows problem I'm trying to implement critical section using objects listed in this article: http://www.mycplus.com/tutorial.asp?TID=290
Somehow, it doesn't work like intended, or maybe I do something wrong.... |
Forum: C++ May 28th, 2008 |
| Replies: 6 Views: 287 |
Forum: C++ May 28th, 2008 |
| Replies: 14 Views: 563 Re: Problem in Inheritance Yeah if you can't understand how to use simple bbcode, where is point od teaching you C++? You should try just a bit making people think on what you posted. My brain threw "Confused by earlier... |
Forum: C++ May 27th, 2008 |
| Replies: 2 Views: 146 Structure members resetting I want recursively fill members of one structure, it looks like this:
struct OPTIONS{
string sDirectoryName;
vector<string> vExtensions;
int uOperationId;
} structCurrentDir;
after filling all... |
Forum: C++ May 22nd, 2008 |
| Replies: 1 Views: 214 Checking string content I'm trying to pass string as filename. I wonder if there is some smart function checking every character of string if it's alphanumeric, or belongs to group of few other character specified?
Loop on... |
Forum: C++ May 21st, 2008 |
| Replies: 4 Views: 311 Re: Delete Folder It lists files, you still need recursively delete directories beginning with deepest path. This calss will be more complex, handling configuration file and multitasking.
DirectoryReader.h:
class... |
Forum: C++ May 21st, 2008 |
| Replies: 4 Views: 311 Re: Delete Folder You need to empty this folder I guess. That's how Windows works if you noticed.
Right now I am working on file listing class, it places all files in given subdirectory in vector of strings. If you... |
Forum: C++ May 21st, 2008 |
| Replies: 6 Views: 247 |
Forum: C++ May 21st, 2008 |
| Replies: 6 Views: 247 |
Forum: C++ May 21st, 2008 |
| Replies: 6 Views: 247 |
Forum: C++ May 21st, 2008 |
| Replies: 6 Views: 247 |
Forum: C++ May 20th, 2008 |
| Replies: 11 Views: 619 Re: SMS(student managent system) WonderAbu have no idea how to ask, and you guys answer quite advanced things. All I could advise is to check out some basics and terminology in... |
Forum: C++ May 19th, 2008 |
| Replies: 12 Views: 1,137 Re: string reverse This way or another, you should use iterators, to avoid exceeding string boundaries.
For example:
string str;
string::iterator iter_str = str.begin();
while(iter_str != str.end())
{...} |
Forum: C++ May 18th, 2008 |
| Replies: 12 Views: 681 Re: Iterator assertion failure. How? If you mean _findfirsti46(), then no. It isn't counted as first result. It only returns handle for future searches. In my previous implementation "." directory was displayed. |
Forum: C++ May 17th, 2008 |
| Replies: 12 Views: 1,137 Re: string reverse I don't really want to think at the moment, but I can post you my string reversing piece of code. Safe and elegant.
#include <string>
string str="shankhs";
reverse(str.begin(), str.end()); |
Forum: C++ May 17th, 2008 |
| Replies: 2 Views: 402 |
Forum: C++ May 17th, 2008 |
| Replies: 12 Views: 681 Re: Iterator assertion failure. How? Nope, not working. Negating whole condition not working also. Only way to get list of files is using && operator, and my brain is melting while thinking why. |
Forum: C++ May 16th, 2008 |
| Replies: 12 Views: 681 Re: Iterator assertion failure. How? yes, it compiles and works ok, but this:
if( (s_current.compare(struct_filedata.name) && s_parrent.compare(struct_filedata.name)) )
{
s_filename = p_sPath + "\\" + struct_filedata.name;
cout... |
Forum: C++ May 16th, 2008 |
| Replies: 12 Views: 681 Re: Iterator assertion failure. How? Ok, here is my solution:
int DirectoryReader::MakeList(string p_sPath)
{
cout << "Parameter: " << p_sPath << endl;
struct _finddatai64_t struct_filedata;
string s_filename = p_sPath +... |
Forum: C++ May 14th, 2008 |
| Replies: 3 Views: 217 Re: linked list You already included namespace std...
As far as i remember from school you have to implement something like this:
struct ListElement
{
int nSomeData;
ListElement *previous, *next; |