|
just #include <time.h>
it is in the compiler includes folder...
TOXCCT >>> GEII power
|
|
|
|
|
Thanks
I have included the time.h file inside .cpp files. but still errors over there.
I just downloaded source codes from here:
http://www.codeproject.com/bitmap/tonyjpeglib.asp
But I can not compile and link it sucefully. Would you like do me a favor and try it see what is the problem?
Thanks
david
|
|
|
|
|
i would do it if i had time, but at the moment, i already take on my time to post on codeproject, but i'm sorry, i cannot do this for you at the moment...
TOXCCT >>> GEII power
|
|
|
|
|
Thanks Geii power
I wait for your reply when you are availiable.
Thanks again
|
|
|
|
|
wow, GEII is the studies i am currently on... it's not me
call me toxcct, i'll be fine for me
TOXCCT >>> GEII power
|
|
|
|
|
Sorry, toxcct;P
I will wait
|
|
|
|
|
I have the following class:
template<typename FLAGTYPE> // may be BYTE, WORD, ULONG...
class Flags {
public:
/**
The boolean indexing operator returns true if the indexed flag bit
is a one.
*/
bool operator[] (long ix) const
{
assert((long)ix >= 0 && (long)ix < 8*sizeof(FLAGTYPE));
return ((m_flags & (1<<ix)) != 0);
}
// ...
protected:
FLAGTYPE m_flags;
};
The bool operator[] makes it possible to write:
Flags<ULONG> f1 = 10;
bool b = f1[3]; // assigns bit 3 of f1, i.e. f1 & 0x08, to b
How do I define indexing and assignment operators that *set* bit 'ix' to a boolean value, so that I can write:
f1[3] = true;
|
|
|
|
|
You can't do that directly because the return value of a function can't be a bitfield. You would need to have operator[] return some object (probably a helper class) that has access to the members of Flags<> variable and an operator= that takes a bool parameter. That operator= would twiddle the right bit.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
- I Want to detect a file which have received from other Computer on LAN. But I don't know way to approach.
--> What's should i do??
--> Can I use Shell Extentions??
thanks
|
|
|
|
|
*How* are you receiving it? If you've fetched it from the other computer, then look at the
application fetching the file.
If it is out of your control, (ie. you have a shared directory, and the other PC pushes the file),
then you may be able to use the FindFirstChangeNotification API function.
Iain.
|
|
|
|
|
I created a structure inside a function definition (which means that the structure will be destroyed when I leave that function scope). While I'm inside that function however, I would like to activate another function (let's call it 'DoSomethingWithStruct') to handle certain activities on that newly created structure.
In the class definition, I am able to get away declaring 'DoSomethingWithStruct' by using a 'void*' as the parameter to pass data between one function and the other.
My problem is, "How do I cast the 'void*' back to the structure when I'm inside 'DoSomethingWithStruct'? (Here's some code.)
class MyClass
{
...
void DoSomethingWithStruct(void* pMyStructure);
};
===============================
void MyClass::FirstFn()
{
struct MyStruct {...};
...
DoSomethingWithStruct(pMyStruct);
...
};
================================
void MyClass::DoSomethingWithStruct(void* pMyStructure)
{
// Here is where I need to cast 'pMyStructure' back from a 'void', to a 'MyStruct' type.
}
================================
I DO NOT want to declare 'MyStruct' as global.
Thanks for any insight.
William
Fortes in fide et opere!
|
|
|
|
|
This would be better
class MyClass
{
...
void DoSomethingWithStruct(MyStruct* pMyStructure);
};
|
|
|
|
|
Thanks for replying.
'MyClass' does not know of 'MyStruct' as a type, hence the reason I used 'void'.
William
Fortes in fide et opere!
|
|
|
|
|
Maybe you can just define the struct inside the class declaration instead of inside the function definition? You can make the struct private, so only members of the class can access it.
|
|
|
|
|
Thanks for replying.
Your answer would presume that I own the class. (My error for referring to the class as 'MyClass'.)
William
Fortes in fide et opere!
|
|
|
|
|
Hi
If you don't own the class, how can you change DoSomethingWithStruct() function definition, since it's a MyClass member?
However, if DoSomethingWithStruct() is not member of MyClass, I don't know of any way (besides making a global structure) to make it aware of the struct. Sorry.
|
|
|
|
|
The point you make is a very good point, and the only answer I can give is that I've become a victim of my own cleverness.
'DoSomethingWithStruct' is a function I recognized I could use, and which I did, except I now find myself limited in what I could use it for.
There are a couple other ways I could go (inheritance being one), but I would like to first explore if a simpler solution might still be available (even if it means applying additional creativity).
Thanks for your replies anyway, I appreciate them.
William
Fortes in fide et opere!
|
|
|
|
|
The definition of the MyStruct type is local to MyClass::FirstFn() and it's not visible in MyClass::DoSomethingWithStruct() . No way around it, them's the rules of the language. You'll need to move the definition of the type into MyClass (type definitions can be nested).
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
Thanks for replying.
I know what you're saying, but I've seen it too many times, when the doors seemed to be closed, there's a book somewhere holding a secret of one of the masters offering something the person didn't know about.
The easiest thing here is for me to say, "Yes, I agree with you," and go the way of tradition (which is NOT always in keeping with what the person wants to achieve). I don't believe I've reached either that bridge, or the end of my line.
Appreciate your response however.
William
Fortes in fide et opere!
|
|
|
|
|
ok, lets see. you pass a struct to your function, but the définition of your struct is not know into the function using it. well, you can do the manipulation by hand, but you (the writer of the function) must know the types of the members. this way, you could do some pointing...
but if one day you change the type of one member in the struct, the function won"t be usable anymore...
TOXCCT >>> GEII power
|
|
|
|
|
Thanks for replying.
There's a lot of permutations to the things you're saying, but don't forget I can overload a function and apply my own set of parameters to it, so long as I make sure I can identify with at least one of the functions already declared in the class.
That was one of the things that attracted me to the function with the 'void*' parameter (because it was already declared and I could use its 'void*' to transfer the struct data to it, and do my work where it's defined).
Considering the amount of effort I might have to invest in order to make this creative idea of mine work, even if I were to succeed, in the end the poor person coming behind me might become lost (most likely would become lost) in the convolution behind the cleverness. That said, I am beginning to feel maybe I should just stick to something simpler; ESPECIALLY if it works!!
William
Fortes in fide et opere!
|
|
|
|
|
TOXCCT >>> GEII power
|
|
|
|
|
WREY wrote:
I DO NOT want to declare 'MyStruct' as global
just curious but, WHY ???
TOXCCT >>> GEII power
|
|
|
|
|
To preserve the "principle of encapsulation".
Bikram Singh
|
|
|
|
|
but we never declare types into a function
you answer, you answer, but do you try to understand the subject ?
TOXCCT >>> GEII power
|
|
|
|