-1

I have a piece of text which I want to write in different text files, so I'm using a while loop to create a new txt file after every loop. However I don't know how to create a new text file AFTER every loop has been completed. For the text, I have a variable outside the loop, so the text is not an issue. I just don't know how to create new multiple files, without rewriting the existing txt file. Can someone please help?

SurvivalMachine
  • 7,946
  • 15
  • 57
  • 87
user6842389
  • 49
  • 1
  • 4
  • 8
  • Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation. [Minimal, complete, verifiable example](http://stackoverflow.com/help/mcve) applies here. We cannot effectively help you until you post your code and accurately describe the problem. – Prune Sep 20 '16 at 22:36

1 Answers1

0

just generate a different filename every time you open the file for writing that would do. Or best would be not to create multiple files. Just write into one file and create (no_of_copies-1) symlinks with different names. This would be efficient.

armak
  • 560
  • 5
  • 13
  • i was thinking of doing that, however if i want to create for example 100 txt files, doing the above method would be time consuming and ineffecient, but thank you! – user6842389 Sep 17 '16 at 10:14