Discussion:
How to using wcsncpy_s on BCB
(too old to reply)
James5950
2008-03-04 06:32:11 UTC
Permalink
Hello Sir,

Why can not use VC API command wcsncpy_s in BCB2007? Have something need
include?

Have any command instead?

Thanks for any comments,

James
Thomas
2008-03-04 06:27:46 UTC
Permalink
Hello James

The VC "wcsncpy" function is the UNICODE version of "strncpy". As far as I know unicode is not supported by CPP Builder or not complete supported. I'm not in the CPP Builder thing so deep anymore, but in the past UNICODE was not very easy with BCB. I think the VCL is not UNICODE capable...

Under VC you must have "_UNICODE" defined to use UNICODE. Maybe this helps you also with BCB

Hope I could help a little bit?

Greetz

Thomas
Remy Lebeau (TeamB)
2008-03-04 18:00:20 UTC
Permalink
Post by Thomas
The VC "wcsncpy" function is the UNICODE version of "strncpy".
Yes, it is, and it is supported by BCB as well. Most of the Unicode
functions of the C library are.
Post by Thomas
As far as I know unicode is not supported by CPP Builder
To an extent, it is.
Post by Thomas
in the past UNICODE was not very easy with BCB.
The UNICODE define, no. But Unicode in general can be used.
Post by Thomas
I think the VCL is not UNICODE capable...
No it is not. That will be implemented in the next version.
Post by Thomas
Under VC you must have "_UNICODE" defined to use UNICODE.
That is not needed in order to use the Unicode functions of the C library.


Gambit
Darko Miletic
2008-03-04 12:09:55 UTC
Permalink
Post by James5950
Hello Sir,
Why can not use VC API command wcsncpy_s in BCB2007? Have something need
include?
wcsncpy_s is not an API, it is a function from microsoft C RTL. You can
not use this in BDS since it has different C RTL that does not implement
this function.
Post by James5950
Have any command instead?
You can use wcsncpy that exists in BDS C RTL.

Just include string.h or cstring.
James5950
2008-03-04 12:25:59 UTC
Permalink
Hello Darko & Thomas

Thanks for your informat, that is very helpful for me.

James
David Dean [CodeGear]
2008-03-04 22:07:56 UTC
Permalink
Post by Darko Miletic
Just include string.h or cstring.
If you use cstring, then the function will be in the std:: namespace.
--
David Dean (CodeGear)
Lead C++ QA Engineer
James5950
2008-03-07 08:54:36 UTC
Permalink
Post by David Dean [CodeGear]
Post by Darko Miletic
Just include string.h or cstring.
If you use cstring, then the function will be in the std:: namespace.
The original code like this :

wcsncpy_s(pszBuffer, bufferLen, varName.pwszVal, _TRUNCATE);

I don't know how to use std::namspace to modify this code for compiler?
Please provide easy code explain for me, thank you.

Best regards,
James
Darko Miletic
2008-03-07 11:20:11 UTC
Permalink
Post by James5950
I don't know how to use std::namspace to modify this code for compiler?
Please provide easy code explain for me, thank you.
No need for that. This code is equivalent to the original:

wcsncpy(pszBuffer, varName.pwszVal, bufferLen);
James5950
2008-03-07 11:37:15 UTC
Permalink
Thanks for your answer.
Post by Darko Miletic
Post by James5950
I don't know how to use std::namspace to modify this code for compiler?
Please provide easy code explain for me, thank you.
wcsncpy(pszBuffer, varName.pwszVal, bufferLen);
James5950
2008-03-07 12:07:04 UTC
Permalink
Hello All,

The MS function use WCHAR for filename.
For example :
void Player::SetWaveFile(WCHAR *pszFileName)
How to change my OpenDialog->FileName AnsiString to WCHAR?
Have any method translate String to UNICODE?

Thanks for any comments,
James
Post by Darko Miletic
Post by James5950
I don't know how to use std::namspace to modify this code for compiler?
Please provide easy code explain for me, thank you.
wcsncpy(pszBuffer, varName.pwszVal, bufferLen);
Loading...