Article View: borland.public.jbuilder.java.language
Article #17413Re: Problems writing newlines to a file
From: Vladimir Olenin
Date: Thu, 19 Nov 1998 00:00
Date: Thu, 19 Nov 1998 00:00
60 lines
2500 bytes
2500 bytes
This is a multi-part message in MIME format.
--------------9C22C6CEACFEDE77E73D9991
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit
Actually, yes. Try changing "\n" with "enter" code (see description of
Char class, as i remember) or Char.ENTER field. (I mean
"test"+'Char.ENTER') This could work. Anyway, u should look through Char
class.
Vladimir
Matt Butler wrote:
>
> 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
--
>~~~~~~~~<=============>~~~~~~~~<
Be yourself no matter what they say...
Join in Java community now!
http://www.geocities.com/SiliconValley/Heights/9815
>~~~~~~~~<=============>~~~~~~~~<
--------------9C22C6CEACFEDE77E73D9991
Content-Type: text/x-vcard; charset=koi8-r;
name="keenonjava.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Vladimir Olenin
Content-Disposition: attachment;
filename="keenonjava.vcf"
begin:vcard
n:Vladimir;Olenin
x-mozilla-html:FALSE
adr:version:2.1;;;;;;
version:2.1
email;internet:keenonjava@collegemail.com
note:Java programmer. Open for project development offers. See my home page at: http://www.geocities.com/SiliconValley/Heights/9815/
end:vcard
--------------9C22C6CEACFEDE77E73D9991--
Technical Details
Message-ID:
<36533B08.3B174FB2@collegemail.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<72sc3h$14a13@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,1b6563995c977abb X-Google-Attributes: gidf74b3,public From: Vladimir Olenin <keenonjava@collegemail.com> Subject: Re: Problems writing newlines to a file Date: 1998/11/19 Message-ID: <36533B08.3B174FB2@collegemail.com> X-Deja-AN: 413288377 References: <72sc3h$14a13@forums.borland.com> To: Matt Butler <butler@cyberramp.net> X-Accept-Language: en,ru Content-Type: multipart/mixed; boundary="------------9C22C6CEACFEDE77E73D9991" Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language