🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17397

Problems writing newlines to a file

#17397
From: Matt Butler
Date: Tue, 17 Nov 1998 00:00
20 lines
1084 bytes
I am having an problem with writing new lines to a file. I have tried
several different things, but to give you an idea here is the latest code I
tried:

      String s = new String("test\n");
      char[] buf = new char[s.length()];
      s.getChars(0,s.length(),buf,0);
      Writer out = new OutputStreamWriter(new
FileOutputStream("D:\\WWW\\Html\\User3.rpt"));
      out.write(buf,0,s.length());
      out.flush();

What is happening is that the \n is coming out as an unprintable character
rather than a newline. It works fine if sent to system.out rather than a
file.

Any ideas?

Thanks,
 Matt
Technical Details
Message-ID: <72sc3h$14a13@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,1b6563995c977abb,start
X-Google-Attributes: gidf74b3,public
From: "Matt Butler" <butler@cyberramp.net>
Subject: Problems writing newlines to a file
Date: 1998/11/17
Message-ID: <72sc3h$14a13@forums.borland.com>
X-Deja-AN: 412832612
Organization: Another Netscape Collabra Server User
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Newsgroups: borland.public.jbuilder.java.language