Re: [OT] Reading utf-8 text file in C/C++

2020-12-05 Thread Greg Keogh
> It's number of characters, not bytes, and it includes the termination - > I'm inclined to declare like this: > wchar_t buff[128]={0}; > After about 17 years since I wrote C/C++ all those sorts of tricks and traps are just a distant memory. I spent a few more hours trying to read utf-8 text

Re: [OT] Reading utf-8 text file in C/C++

2020-12-05 Thread mike smith
It's number of characters, not bytes, and it includes the termination - I'm inclined to declare like this: wchar_t buff[128]={0}; So if it fails, you have zeros in it, instead of what was left in the stack ... On Sun, Dec 6, 2020, 11:27 Greg Keogh wrote: > > Did you look at the iconv API? >>

Re: [OT] Reading utf-8 text file in C/C++

2020-12-05 Thread Greg Keogh
> Did you look at the iconv API? > I didn't know about that, but I was hoping to avoid things like it. After another hour of stuffing around and reading the fine print of the old C library functions

Re: [OT] Reading utf-8 text file in C/C++

2020-11-29 Thread mike smith
Did you look at the iconv API? Mike On Sun, Nov 29, 2020, 18:34 Greg Keogh wrote: > Some of you may remember learning C, and somewhere around page 4 of your > textbook you learn how to use *fopen*, *fgets *and *fclose *to loop and > read the string lines out of a file. But times have