|
Hi Raju,
Tell us what u want to do.
|
|
|
|
|
hi..thanks for ur replay/
i wanna create serial no file...without using keyword
Thanks
Raju.K
raju.k
|
|
|
|
|
Do you mean adding serial numbers to the file names? Such as:
AAA00001.tmp
AAB00002.tmp
ABD00003.tmp
ACF00004.tmp
Maxwell Chen
|
|
|
|
|
hi ..
like the serial no :
1.
2.
3.
4.
etc
like this only
Thanks
Raju.K
raju.k
|
|
|
|
|
char* GenerateSerialNumberStr(char* str)
{
static int i = 1;
sprintf(str, "%d.", i++);
return str;
}
Maxwell Chen
modified on Monday, January 28, 2008 3:06:47 AM
|
|
|
|
|
Hi Chen ..Thanks for your replay..
i have the total file length like this only .i wanna create the serial no this total length of the file how its possible ..
Lfile.Write("",Lfile.GetLength());
Thanks
Raju.K
raju.k
|
|
|
|
|
Hi Thanks for your replay..
i have the total file length like this only .i wanna create the serial no this total length of the file how its possible ..
Lfile.Write("",Lfile.GetLength());
Lfile is nothing but object of CFile.This Lfile contains some list of datas.
Thanks!!
Raju.K
|
|
|
|
|
Hi Maxwell!!
Probably you forget to increment value of "i" before return like i = i + 1; .
Why you are having char* argument as you are returning char*?
Regards,
Suman
|
|
|
|
|
rp_suman wrote: Probably you forget to increment value of "i" before return like i = i + 1;.
Yes I forgot. Sorry!
rp_suman wrote: Why you are having char* argument as you are returning char*?
To return the original address for later use. As:
char* Test(char* str)
{
static int i = 1;
sprintf(str, "%d.", i++);
return str;
}
char sBuf[10] = {0};
int v = 0;
for( ; v < 3; v++) {
printf(Test(sBuf));
printf("\n");
}
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: To return the original address for later use.
That's nice..
Thanks & Regards,
Suman
|
|
|
|
|
Hi all,
I have a class and one of it has a function as follows.
void CMsgRecorder::SetGroupState(char chState)
{
}
defining as follows,
class CMsgRecorder
{
public:
void SetGroupState(char chState);
}
Other class has following function.
void CRfSvrDriver::ShowInfo()
{
}
It's also define as public function in CRfSvrDriver class. How can I call SetGroupState() from the ShowInfo() which are in two classes.
Help really appreciate
I appreciate your help all the time...
Eranga
|
|
|
|
|
use inheritance.
class CMsgRecorder
{
public:
void SetGroupState(char chState)
{
do-something;
}
};
class CRfSvrDriver : public CMsgRecorder
{
public:
void ShowInfo()
{
SetGroupState();//calls the base function CMsgRecorder::SetGroupState
}
};
|
|
|
|
|
Yes I do, but the question is this. I already use one class there as follows.
class CRfSvrDriver :
public CCmdDriver
How can I used another class, how to separate those two
I appreciate your help all the time...
Eranga
|
|
|
|
|
then why don't you try this
class CRfSvrDriver :public CCmdDriver,public MsgRecorder
OR
u want to maintain two separate version of the class CRfSvrDriver ?
|
|
|
|
|
Ok, I can separate by a comma and do it. But then I comes with a constructor issue. I can't change my constructor now.
So I change my plan, simply used a pointer to the other class as follows. Include the CMsgRecorder header file in the ShowInfo header file.
void CRfSvrDriver::ShowInfo(CMsgRecorder* msgRec)
{
msgRec->SetGroupState('R');
}
But it gives a compile error.
error LNK2019: unresolved external symbol "public: void __thiscall CMsgRecorder::SetGroupState(char)"
(?SetGroupState@CMsgRecorder@@QAEXD@Z) referenced in function "public: int __thiscall
CRfSvrDriver::ProcessCommand(class ATL::CStringT<char,class strtraitmfc_dll<char,class="" atl::chtraitscrt<char=""> >
>,unsigned int,class CMsgRecorder *)"
(?ProcessCommand@CRfSvrDriver@@QAEHV?$CStringT@DV?$StrTraitMFC_DLL@DV?$
ChTraitsCRT@D@ATL@@@@@ATL@@IPAVCMsgRecorder@@@Z)
</char,class>
I hope it is linker error, but all functions are declared correctly. You have any suggestion for me on this.
I appreciate your help all the time...
Eranga
|
|
|
|
|
the linker cannot find the definition of SetGroupState that is the problem. whether u declared SetGroupState as a static function? or not defined it.
And another thing i don't think the method u opted is a good programming practice. Inheritance is the good method in such situations.
|
|
|
|
|
Ok pal. Thanks.
Actually I missed one thing there. Those two classes are in two projects. I think that is why there is a linker error. What I can do now.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Then make a DLL of the project that contains class CMsgRecorder. Then include .h file of the class and lib file in your new project. Then compile it. ie's it.
|
|
|
|
|
I'll see, because working with DLLs are really new work for me.
I appreciate your help all the time...
Eranga
|
|
|
|
|
class CMsgRecorder
{
public:
void SetGroupState(char chState)
{
do-something;
}
};
Now you can use multi-one inheritance like this
class CRfSvrDriver : public CMsgRecorder,public CCmdDriver
{
public:
void ShowInfo()
{
SetGroupState();//calls the base function CMsgRecorder::SetGroupState
}
};
|
|
|
|
|
Hello everyone,
As far as I know, C function does not throw exception.
But Bjarne said in his book, section 14.8 Exception and Efficiency,
--------------------
In particular, an implementation knows that only a few standard C library functions (such as atexit() and qsort()) can throw exceptions, and it can take advantage of that fact to generate better code.
--------------------
What did he mean? C function could really throw exception? What exception -- C++ exception or structured exception?
thanks in advance,
George
|
|
|
|
|
Why don't you read the next paragraph?!
Maxwell Chen
|
|
|
|
|
I read all the section, Maxwell!
Could you show your point to my original question please?
regards,
George
|
|
|
|
|
"... it might have been converted ..."
Maxwell Chen
|
|
|
|
|
Hi Maxwell,
The whole sentence is "it might have been converted to use the C++ operator new". How could C code use C++ operator new?
regards,
George
|
|
|
|