So I was presented with a situation where I needed a binary to simply run some predetermined commands on Windows. I said, "Why, this is a simple fork/exec under Linux. How hard could it be in Windows?"
Turns out, a lot fscking harder than it needs to be.
The primary problem stems from the way Windows "attempts" to support multibyte characters. Or rather, the wayS it supports multibyte characters... you have a choice of the ANSIish widechar that can do UTF-8, or the one that MS Visual Studio defaults to LPWSTR for UTF-16. The Windows libraries helpfully provide replacement functions for stuff like sprintf() and such, but the common and well known string functions are cut off from you. Worse, some wrappers to system calls like GetCurrentDirectory() will only return LPWSTR and only take LPWSTR args, and because these are differently sized types you can't just cast your out of the problem.
Oh, and stuff like malloc()/calloc() doesn't appear to work with the macros, either. Or at least I didn't have the time to unravel what the correct way to use them were in the time I had alotted.
In the end, I used something like:
wchar_t* thing[SIZE];
and just used a typecast whenever I needed to move into or out of the variable: (LPRWSTR) thing, like when using _stprintf() to build up these strings.
So, basically, I ended up being corralled into doing freshman level C just to get stuff working.
What I've taken away from this experience is that I absolutely, positively, 100% don not ever want to do any serious Win32 C/C++ development. Ever. EVER. And if I do have to go down that road, then I'm going to try and stick with ANSI... maybe even to the point of using cygwin exclusively to avoid getting sucked into this nightmare again.
Wednesday, January 13, 2010
kindle 2 weeks later
I still like what I said before about the Kindle, but the one thing it hasn't done is spurred my recreational reading. Yeah, I can rip through books quicker, but having trouble finding the time to actually commit to reading. Suspect this is work related, since I'm basically learning (or relearning) tech just about each day.
I tried out the magazine and newspaper subscriptions, but I found that even those weren't enough incentive to turn the sucker on each morning. I also found that periodicals who are publishing their content in Kindle format are playing this weak game of not including everything and instead reserving that for customers who have paid for subs to their website (or ordered the dead tree version). Same money, less content? No, but thanks anyway.
I'm also discovering that anything beyond new releases is going to be kind of hard to find kindlefied. An elusive book that has remained on my Stuff To Read list for way too long is When Harlie was One... but it's been out of print for nearly decades. The only way I'm likely to see it is if I can track it down at the library or maybe stumble across it in the Half Price Bookstore. Chances of getting via kindle (legally) are pretty low.
In other news, I've discovered that if you put the text to speech feature on it's fastest setting and use the female voice, it does a passable job of reading flowing prose to you at a rate that doesn't require too much attention. Was able to drive with it going on.
Bottom line: it's by no means perfect, but it's got enough bonuses to justify purchase. And those are mainly, 1) text to speech, 2) ability to convert your own material to kindle format, and 3) the fact that I won't have another 5 boxes of books to pack up.
I tried out the magazine and newspaper subscriptions, but I found that even those weren't enough incentive to turn the sucker on each morning. I also found that periodicals who are publishing their content in Kindle format are playing this weak game of not including everything and instead reserving that for customers who have paid for subs to their website (or ordered the dead tree version). Same money, less content? No, but thanks anyway.
I'm also discovering that anything beyond new releases is going to be kind of hard to find kindlefied. An elusive book that has remained on my Stuff To Read list for way too long is When Harlie was One... but it's been out of print for nearly decades. The only way I'm likely to see it is if I can track it down at the library or maybe stumble across it in the Half Price Bookstore. Chances of getting via kindle (legally) are pretty low.
In other news, I've discovered that if you put the text to speech feature on it's fastest setting and use the female voice, it does a passable job of reading flowing prose to you at a rate that doesn't require too much attention. Was able to drive with it going on.
Bottom line: it's by no means perfect, but it's got enough bonuses to justify purchase. And those are mainly, 1) text to speech, 2) ability to convert your own material to kindle format, and 3) the fact that I won't have another 5 boxes of books to pack up.
Subscribe to:
Posts (Atom)