Ninjakreborn Posted January 31, 2010 Share Posted January 31, 2010 if (std::strcmp(answer, "yes")) { std::cout<<"Please stand by while the data is being gathered and the file is being generated...\n"; std::ofstream outfile("C:/Users/businessman332211/Desktop/test.txt"); outfile << "This is data." << std::endl; outfile.close(); system("pause"); } I had this figured out before, but I stepped away from C++ and I am trying to pick up where I left off. basically I just want to generate a text file on the desktop...This isn't working even though everything i have read tells me it should Another question..what happens if I want to step out of the C drive and access another drive...for example an External harddrive, or a secondary drive on the same computer? Link to comment https://forums.phpfreaks.com/topic/190427-c-question/ Share on other sites More sharing options...
Ninjakreborn Posted January 31, 2010 Author Share Posted January 31, 2010 Nevermind..it was me using the compare function wrong. if (std::strcmp(answer, "yes") == 0) { std::cout<<"Please stand by while the data is being gathered and the file is being generated...\n"; std::ofstream myfile; myfile.open("C:/Users/businessman332211/Desktop/example.txt"); myfile<<"This is data."; myfile.close(); return 0; } That is the right way. Link to comment https://forums.phpfreaks.com/topic/190427-c-question/#findComment-1004497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.