Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need wstring? #10

Open
hexianzhi opened this issue Jan 15, 2020 · 0 comments
Open

Need wstring? #10

hexianzhi opened this issue Jan 15, 2020 · 0 comments

Comments

@hexianzhi
Copy link

hexianzhi commented Jan 15, 2020

When wchar_t.string 's value pass to a function with wstring parameter, the parameter will not print.

Example:
node.js code:

var MyLibrary = ffi.Library(mathPath, {
  'getPassword': [  ref.types.void, [wstring]]
})
const bb = MyLibrary.getPassword('123456')

cpp code:

void getPassword (wstring s1) {
	std::wcout.imbue(std::locale("chs"));
        // s1 is empty
	std::wcout << "s1: " << s1 << L' ';
}

The result is: s1:
Expect result : s1:123456

But if parameter s1 is w_char* ,the '123456' string will show,as void getPassword(wchar_t *s1)

Can we get a wstring type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant