Hello i am using a public computer (im just starting out with c++) so i dont have the code on me but i have figured out how to create a text file.

what i want to know is when i create it, it places it in the direcotry that my exe file is located. i want to know the code to put it in a specific place but not user defined i want the program to put it in that place every time. basicly when the program runs it creates a text file and i want to put it in a specific place

could sombody please show me the headers and codes to use to do this thanks

(please note i have looked and i have figured out how to make the text file just not put it in a predetermened place thanks)

just specifiy the full path along with the filename, like this. Notice that you have to have two \\ as folder separators. ofstream out("c:\\mypath\\file.txt");

Thankyou, i knew it would be simple just did not know where to add the path, cheers for that i got a long way b4 you can call me Mr Gates lol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.