Skip to content
This repository was archived by the owner on Jan 17, 2024. It is now read-only.

String to NativeUtf8 issues #146

Closed
fayfive opened this issue Jun 16, 2022 · 2 comments
Closed

String to NativeUtf8 issues #146

fayfive opened this issue Jun 16, 2022 · 2 comments

Comments

@fayfive
Copy link

fayfive commented Jun 16, 2022

Platform: Ubuntu 18.04
Dart SDK version: 2.17.3

Pointer<Char> url ="http://172.16.5.12/index".toNativeUtf8().cast<Char>();
and then I printf in C. Sometimes, it show that http://172.16.5.12/index\\07

I must do that url.elementAt("http://172.16.5.12/index".length).value = 0;

I don't knwo if it works well.

@dcharkes
Copy link
Contributor

We should already be doing that

nativeString[units.length] = 0;

https://github.com/dart-lang/ffi/blob/master/lib/src/utf8.dart#L86

Could you make a minimal reproduction to ensure that it's not other code causing this?

Does it repro with:

@fayfive
Copy link
Author

fayfive commented Jun 17, 2022

It's my mistake.

@fayfive fayfive closed this as completed Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants