# Write out # to a file [duplicate]

I'm writing to a file from within my document. At a certain location, I would like to actually write out the character #. I tried something like this:

``````\newwrite\tempo
\immediate\openout\tempo=outputo.txt
\immediate\write\tempo{\# This is a generated file, DO NOT EDIT directly.}
``````

However, this writes out '\#' to that file, which is not what I want. The idea is that the file which is written out by the documentation in latex is automatically used from within a test-suite, and # denotes a comment in that file, so there should be no \ in front.

Leaving out the \ obviously does not work, nor did wrapping the # in another command.

Suggestions? Yves

``````\setupsavebuffer[prefix=no]