Forum: C++ Jun 14th, 2008 |
| Replies: 5 Views: 1,011 I'm quite sure he asked how to test keypress in while but I have no idea how to do it while( now) |
Forum: C++ Jun 14th, 2008 |
| Replies: 17 Views: 1,610 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... |
Forum: C++ Jun 13th, 2008 |
| Replies: 17 Views: 1,610 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... |
Forum: C++ Jun 13th, 2008 |
| Replies: 17 Views: 1,610 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: 1,610 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 DirectoryReader
{... |
Forum: C++ Jun 13th, 2008 |
| Replies: 2 Views: 387 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: 2,930 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: 1,610 Ok I figured out that static const must be initialize within class body, but still:
class MultiReader :
public DirectoryReader
{
public:
MultiReader(char* p_sConfigPath);... |
Forum: C++ Jun 12th, 2008 |
| Replies: 7 Views: 2,930 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: 2,930 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: 1,610 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 DirectoryReader
{
public:... |
Forum: C++ Jun 12th, 2008 |
| Replies: 7 Views: 2,930 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... |
Forum: C++ Jun 12th, 2008 |
| Replies: 7 Views: 2,930 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... |
Forum: C++ Jun 7th, 2008 |
| Replies: 19 Views: 1,210 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: 1,647 #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: 1,610 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: 1,610 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: 1,610 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: 1,042 How about casting
int* a = (int*)x;? |
Forum: C++ May 31st, 2008 |
| Replies: 3 Views: 695 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: 1,610 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: 1,022 All I can tell on this subject is: compilator do not detect problems or errors with directx, only withyour C++ syntax.
Try get Dev C++ help on that error. Errors often are indicated at end of file,... |
Forum: C++ May 28th, 2008 |
| Replies: 14 Views: 1,000 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: 364 I want recursively fill members of one structure, it looks like this:
struct OPTIONS{
string sDirectoryName;
vector<string> vExtensions;
int uOperationId;
} structCurrentDir;
after... |
Forum: C++ May 22nd, 2008 |
| Replies: 1 Views: 534 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: Network Security May 21st, 2008 |
| Replies: 6 Views: 2,937 How is this possible technically? Every single mail server will archive emails and IMs..? |
Forum: C++ May 21st, 2008 |
| Replies: 4 Views: 768 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:
... |
Forum: C++ May 21st, 2008 |
| Replies: 4 Views: 768 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: 501 Pretty confusing I must say... I think I will skip it for now. I don't know final shape of my solution now. |
Forum: C++ May 21st, 2008 |
| Replies: 6 Views: 501 What if EdRules is part of another class?
And another class is part of another? Exception catching should be performed in each of these? |
Forum: C++ May 21st, 2008 |
| Replies: 6 Views: 501 Can you please give simpliest example? |
Forum: C++ May 21st, 2008 |
| Replies: 6 Views: 501 I'm starting writing class that should read configuration file and initialize some members with data from file. I decided to read this file in constructor. What should constructor do, if something... |
Forum: C++ May 20th, 2008 |
| Replies: 11 Views: 1,104 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 C++:... |
Forum: C++ May 19th, 2008 |
| Replies: 12 Views: 4,723 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: 1,173 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: 4,723 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: 912 http://www.cppreference.com/cppstring/find.html
Use 1st variant in some kind of loop. |
Forum: Linux Servers and Apache May 17th, 2008 |
| Replies: 3 Views: 1,566 For some reason I don't want develop for Linux. It usually lacks hi-level functions and you have to use fork(), shmget(), etc. You have much more free hand writing for Windows, and there is variety... |
Forum: C++ May 17th, 2008 |
| Replies: 12 Views: 1,173 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: 1,173 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;
... |