I don't remember where I read this, but it's in C, and here's the deal:
  1. Create a file called void main(){puts("Hello, World!");}, assuming your filesystem will allow it.
  2. Its contents should be:

        __FILE__

  3. Compile it with -istdio.h
Quite clever. Although gcc won't let you compile it without a file extension.

Update I was talking this over with Bozyo the other day. We decided that you can do it like this: on the command line:

gcc -Df=__FILE__ -Dc=// -istdio.h void*.c, then add a "c .c" to the filename and change the content to "f".