Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get output in next line  RSS feed

 
Steve Pickle
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Team,

I have one classFrom Another class

Below is logic to print in dos command prompt and in output fileIt looks like, on dos promt, out put is getting perfectly line by line next line, but in out file only last line is written. Can you please let me know what to change to get proper output in out file.

 
Campbell Ritchie
Marshal
Posts: 55722
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Always use code tags, and make sure to indent your code. I shall go back and try to add code tags to your post, and you can see how much better it looks

Your write method appears to be using CREATE mode. Does that meant that every time you call the method you are creating the file anew? If so, you will only see the most recently‑written text.

[edit]: Code tags? Success I also removed some unused tags, some unnecessary empty space and empty lines. Don't mix tab characters and spaces, otherwise your indentation will look very peculiar.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!