|
물소리 님이 쓰신 글 :
: 혹시 님이 원하시는것이 이것인가요?
:
: #include <stdarg.h>
:
: void TFormMain::ShowMsg(char *pFormat, ...)
: {
: char pStrBuff[2048];
: va_list argptr;
:
: va_start(argptr, pFormat);
: vsprintf(pStrBuff, pFormat, argptr);
: va_end(argptr);
:
: ShowMessage(pStrBuff);
: }
: 또는 sprintf()를 이용하여 문자열을 만든후에 사용하여도 무방하겠지요.
:
: 김진락 님이 쓰신 글 :
: : 델파이를 사용하다 이제 막 C빌더로 넘어온 초봅니다...
: :
: : 델에서 사용하던 Library를 빌더로 옮기는중에 막히는 부분이 있어서...
: :
: : Function ShowMsg(sMsg: String; const Args: array of const)
: : begin
: : ShowMessage(Format(sMsg, Args);
: : end;
: :
: : ShowMsg('어찌하면 %s %s', ['될까요', '알려주세요~~']);
: :
: : 이렇게 사용하던 함수가 있었는데
: :
: : 빌더에서 array of const를 선언하는 부분부터 막히네요..
: :
: : 함수 원형은
: : AnsiString __fastcall Format(const AnsiString Format, const System::TVarRec* Args, const int Args_Size);
: : 이런데 우째해야 될지 감이 안오네요...
: :
: : 그래서 다음과 같이 했는데요
: :
: : void __fastcall TForm1::FormatTest(const AnsiString str, const System::TVarRec* Args, const int Args_Size)
: : {
: : Edit2->Text = Format(str, (TVarRec *)Args, Args_Size);
: : }
: :
: : void __fastcall TForm1::Button1Click(TObject *Sender)
: : {
: : FormatTest("There are now %d,%s records in the table", ARRAYOFCONST((10, "가나다")));
: : }
: :
: : 이게 맞는건가요????
: :
: :
: : 예전에 C에서 사용한 myprintf(char *format,...) <= 요것도 안되던데... 좀 알려주세요...흑흑..
|