Support Forums
Help with naming a txt! - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Programming with C++ (https://www.supportforums.net/forumdisplay.php?fid=20)
+---- Thread: Help with naming a txt! (/showthread.php?tid=20114)

Pages: 1 2


Help with naming a txt! - Dr.BrokenGod - 07-01-2011

I need a code that when I run the program it asks me to enter a name and when I press enter it creates a file named exactly as I typed in and to be .txt

And other thing is how to make the file be created on desktop or some other folder and not in same directory where program is!?


RE: Help with naming a txt! - 0xE9 - 07-01-2011

You should really consider learning the basics of C++.


RE: Help with naming a txt! - ★ASI_F★™ - 07-01-2011

i can help this thing on vb.net but c++ Sad


RE: Help with naming a txt! - Dr.BrokenGod - 07-01-2011

(07-01-2011, 09:57 AM)0xE9 Wrote: You should really consider learning the basics of C++.

Yeah I know basics but I have problem wit this! Its all my teacher explained only not how to do this and It is pissing me off!


RE: Help with naming a txt! - Kyle FYI™ - 07-01-2011

(07-01-2011, 09:57 AM)0xE9 Wrote: You should really consider learning the basics of C++.

I was going to say that.



RE: Help with naming a txt! - Dr.BrokenGod - 07-01-2011

Great if you all are so clever will someone help! It is support forum dam don't be assholes! Help or don't bother posting!


RE: Help with naming a txt! - haphazard - 09-14-2011

easy as hell man
do you need a graphical user interface or a command line version?





RE: Help with naming a txt! - Godly™ - 09-14-2011

Dude this is easy, you need to learn some more about C++


RE: Help with naming a txt! - haphazard - 09-14-2011

wut is your ide btw?
visual studio, qt creator, codeblcocks (etc)

anyways I am at school and I dont have my programming companion (qt creator) with me put fire this up and tell me if it works. this will support a CL interface, so make a new "console C++ application".. from here it is very easy to port it to a GUI with an inputbox and button
Code:
#include <iostream>
  #include <fstream>
  using namespace std;
  int main () {
  ofstream myfile;
  int filename;
  cout << "Please enter a text file name: ";
  cin >> filename;
  cout << "text file " << filename;
  myfile.open (filename);
  myfile << "Writing this to a file.\n";
  myfile.close();
  return 0;
}



RE: Help with naming a txt! - hacker - 09-14-2011

yeah, you should learn the basics before doing anything else, try reading tutorials