Use %ls format specifier for README example #469
No reviewers
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi!469
Loading…
Reference in a new issue
No description provided.
Delete branch "patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I finally got it running, but it was printing only the first character. %ls is for wide strings and works.
https://devblogs.microsoft.com/oldnewthing/20190830-00/?p=102823
"If you want your code to work both on runtimes that use the Windows classic printf rules as well as those that use C standard printf rules, you can limit yourself to %hs for narrow strings and %ls for wide strings, and you’ll get consistent results regardless of whether the format string was passed to sprintf or wsprintf."
Thanks!
(It probably should exit when hid_open returns NULL, also, or it produces SIGSEGV when the device isn't plugged in. Confusing for beginners like me.)
Also apparently you can't output with
printfandwprintfin the same file...I guess for beginners the hidtest would be a better sample and it was updated/improved over time a lot.
I you want to improve sample in the README (e.g. replace
wprintfwithprintfas it is used inhidtest) - you're very welcome to do so.@Youw Yeah, I'm just new to this and not sure of the conventions, but I'll try.
Pull request closed