Warning: geek content ahead.
When my nose is to the grindstone, I use C++ pretty frequently. One (honestly quite minor) thing about the language has been bothering me of late.
The standard library provided with C++ has a set of facilities (“classes” for those of you in the know) for writing things (primarily to files) called iostreams. It also provides a ‘string’ class to manage ‘strings’ of characters; like this sentence, for instance.
To open a file with an iostream (an fstream specifically) you have to provide a filename. Filenames, like all words, consist of a series (or string) of characters. As such, you might hope to provide the requisite file name in a string object…
But your hopes would be dashed. C++ is based on an earlier language, called (get ready for it) C. In C, strings of characters were handled by a special convention: you would “point” to a place in memory that held the series of characters, and a “null” value (zero) would mark the end of the string. In C++ parlance, the creatures that use this convention are called c-strs. Guess what format the fstream class expects of file names? Yup, the c-str.
Now, I don’t mind that fstream accepts c-strs. There are still an awful lot of them floating around, and if you’re mixing C (or C-style) code with C++ — the chances of which are excellent — you’ll appreciate that fstream does this. But why, oh why, does fstream not accept file names in the form of a string object? Why must I convert a C++ construct (the string object containing the file name) to a C construct (a c-str containing the file name) in order to use a C++ construct (the fstream)?
Poor form, in my book.
I did get a bit of good news as a result of my friend’s misfortune. Another college friend, a Captain in the Army stationed in (where else?) Iraq, responded to the group email about the bad news.
Great to hear he’s ok; awful that a tumor triggered it.
I know someone who could use them. A friend from college, a year younger than me, was admitted to the hospital yesterday with a tumor on his brain the size of lemon. No idea as to malignancy. Operation is tomorrow at 0700.
If you can spare some good vibes, send ’em his way.
2006.06.29, 1549 EDT: Well, he’s out of surgery. Doctors were able to remove 85% of the tumor. Unfortunately, it is malignant, so he’ll have to start rounds of chemo and/or radiation.
Keep those thoughts coming.
A nice example of what Congressional “logic” must look like.
The eldest just earned his white belt in Tae Kwon Do. Unfortunately, Kathy was down with a migraine so our friends who also have a kid in the class took him. I imagine he’s pretty darn proud of himself right now….
anyone out there know where I can get an ark, cheap?
We have some serious “40 days and 40 nights” action shaping up here…nothing compared to the streak Seattle saw a few months ago, but we trying to turn DC into Venice.
when you post links to stuff like this.
It’s been rainy, with thunderstorms, since Thursday of last week here. Even after living in places that get rainfall and thunderstorms on a pretty regular basis (OH, MD, and VA) for the past 14 years, I’m still not completely adjusted to it.
For instance, last night we had 13.97 cm (5.5 inches) of rain. That’s somewhere between 1/3 and 1/2 the average annual precipitation for my hometown; most of that is winter snowfall!
The real problem I’m having with the rain the past week, though, is power outages. There have only been two, but they were 7.5 and 6.5 hours long. The first happened when the temp was over 80F at 11:45 pm, the second last night at about 7:40 pm. The discomfort from lack of A/C (and unwillingness to open windows during thunderstorm) was just enough to be irritating. What made it worse? In both cases, our neighbors behind us and two streets in front of us had power.
The storm that caused the first outage passed relatively quickly, so we did get to open the windows and let some air circulate… We also were serenaded by the hum of our neighbors functioning air conditioning….