I have learned c++ over a long period of time and i have decided to use it to create windows programs with it. Right now, I am just practicing. I have made a window with three menus at the top. when you click one of the menuitems, a dialog box should appear asking whether or not the user likes my program or not. If you press Good (which is actually an IDOK) it should write to a text file "good" and if you click bad (which is actually IDCANCEL, I know, i could have used YES and NO) then it should write to the text file "bad". What api shall i use for the file i/o. because i have never used file i/o in win api programming. should i use createfile() and writefile()?

Hmm, interesting.
I think its quite useless, though, what you want to do. There might be a way around, but meanwhile:

yea i knowo it is useless, its just practice of using basic apis and stuff.
Also, that is the site that i have been using. What i was asking was what api shall I use to write text into a .txt file. I know about fstream but I don't think I can use that in my code because its windows programming not console.

You will need to use CreateFile to create the file and then WriteFile to write the text. Don't forget CloseHandle() when your're done
HANDLE hFile=CreateFile(....);

That's it, this may help