how to accept user input text while in game?

I am looking for a solution on how we can put a text window in a game and store that input in to a file.

i am not talking about text editor but while playing game, i want to store user input text into a file.

some help is appreciated.