The best answers would ideally answer the question as asked (or explain why it can't be done) and also show a still more excellent way.
[1]: http://weblogs.asp.net/alex_papadimoulis/archive/2005/05/25/...
[2]: http://meta.stackoverflow.com/questions/66377/what-is-the-xy...
There are times I've asked how to do X, and for various reasons X is really, no kidding, exactly what wanted to do. Still, numerous people would question my desire to do X, turning the discussion into an inquisition on motives or skill comprehension.
I'm sure in some odd way they all meant well, but they were spending a lot of cycles not actually answering the question.
In those cases the better strategy is to, under some crafty pretext, bluntly assert that X cannot be done.
This will evoke numerous rebuttals with full details on just how incredibly wrong and foolish that claim is.
Both cases play to a trait all too common to many people on discussion boards: replying to questions with the primary goal of showing that you are, in fact, smarter than everyone else.
Only, more often than not, people think they always know better and everyone asking a question must either not know the proper way of doing things, and why in the world are they trying to do <question_asked> ? This then leads to a debate about me trying to solve problem X which requires me to solve Y which requires me to do Z, which led me to ask the question. At the end, I get the exact answer I was looking for, but that took longer than necessary because other were looking at it the same way you described, that it's the XY problem. I can't help but feel that it mostly just wasted my time a lot.
You don't always have to know the entire story behind the code to give straight answers, is all I'm saying. :)
One thing I've found is that, beyond a pretty low floor, more details often means less answers. If you, forex, post your C code and ask why it doesn't work on IRIX, people will say "it must be something weird about IRIX, I don't care about that" and ignore you. If you post it without mentioning the OS, you can get some good answers.