Dec 18, 2006 03:18
Warning: This entry is about computer programming. Luddites and artsies beware!
I've spent the past couple of days working on a computer program.
See, for years I've kept a journal electronically. When I was around 13 or so, I kept a journal via Lotus Organizer. That worked for a while, but eventually the file grew so large that the program refused to open it. (What a bug!) At that tender age, I had the skills and free time to hack the file to get my data back (the "encryption" was a joke) but I resolved not to use a foreign program for something so important again. No, I was going to write my own journal software.
And lo, the software was written. Seven years ago. In Visual Basic 2.
You can stop laughing now.
I tried to update the program a couple of years ago with Visual Basic 6, but alas it didn't work out. The executable tripled in size, it became much more difficult to copy around to other computers, and a critical bug was somehow introduced which would nuke journal entries. (Yay backups!.) But VB6 is irrelevant anyway. For years and years, I've wanted to write a better client in C++.
And that's just what I've started doing. Even better, it's real C++ - no Visual C++ or MFC crap for me, I'm writing the thing in Dev-C++ and working directly with the Windows API. Mmmmm, 1337n355.
I've hit a couple of snags, though. See, my intention was to write a bunch of classes and methods to handle my files independent of Windows, such that I could more easily write a Linux client later. Alas, the inclusion of fstream.h and strings.h make my executable swell up to almost half a megabyte. Also, whenever I try to put a block of text into an EDIT control, it displays carriage returns and line feeds as little black boxes, rather than, you know, moving the text to a new line. I downloaded and compiled the source of a simple notepad-esque text editor, and it doesn't have either of those problems. Total executable size: 36 389 bytes.
I think I'll have to rewrite the classes using the same tools that the notepad utilizes. No fstream or char buffers, I'll have to use the WinAPI's CreateFile function and LPSTR instead. You win this round, Windows. [shakes fist]
In closing, I have a question for the Linux gurus out there: I have the Win32 programmer's reference, is there a similar bible for developing for X11/Gnome/KDE? Can someone point me to their favourite tutorial? Once I'm out of school (ha!) I'll be spending a lot more time writing software for both platforms. Hell, some of it might even be useful.
programming,
geek,
linux