Andromeda
Andromeda

Reputation: 550

How to do this Delphi procedure in BCB XE

I need to use IncMonth procedure directly from SysUtils header but I don't know how to use SysUtils.IncMonth() in C++ Builder XE.

Anyone can help me how to do that in C++ Builder XE?

Thanks in advance..

Upvotes: 1

Views: 198

Answers (1)

TLama
TLama

Reputation: 76713

If you encounter ambiguity between two functions, you'll need to specify namespace of the function you want to call to let the compiler know which one you're calling. In your case it will be:

SysUtils::IncMonth()

In a code it might look like this:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    TDateTime TwoMonthsLater = SysUtils::IncMonth(Now(), 2);
    ShowMessage(DateToStr(TwoMonthsLater));
}

Whenever you get a compiler error or warning, you may take a look at the reference, which almost always contains also an example how to resolve a certain error or warning.

Upvotes: 4

Related Questions