   File paths
  Ok noob thread but thats why this forum was created so here goes.Im writing a simple code that will basicaly write to a file.Now the code that opens the file looks something like this at the moment.ofstream myFile("example.txt");This works fine as long as i want the file to be saved in the same folder as the program. But how would i change the code so that it would save the file in c:\ ?Thnx in advance.[edited by - krypto night on February 2, 2004 6:23:13 PM]
#include <fstream>int main(int, char **) {  std::ofstream ofs("C:\\temp.txt");  ofs << "Some random text" << std::endl;  return 0;}  Just remember to use \\ instead of just \ when creating your path. \ is an escape character so you need two in a row if you mean just one. ;  You can use forward slashes as well, to avoid typing double slashes.your path would be "C:/temp.txt" ;  Ok thhanks 4 your help. 