开发者

How do I insert line breaks into a text file i'm creating on the SD Card?

开发者 https://www.devze.com 2023-01-11 21:58 出处:网络
My code is pretty standard.. sReport contains the text I would like output to the text file, and it contains several \"\\n\" line breaks that render fine in a textview, but in the text file they\'re n

My code is pretty standard.. sReport contains the text I would like output to the text file, and it contains several "\n" line breaks that render fine in a textview, but in the text file they're non-existent. There must be something easy i'm missing..

    try {
        FileOutputStream fOut = new FileOutputStream(sDir + sFile);
        //write  
        fOut.write( sReport.getBytes() );
        // Close output开发者_开发知识库 stream
        fOut.flush();
        fOut.close();
    } catch (IOException  e) {
        e.printStackTrace();
    }


please review this and keep in mind Android is Linux based.

0

精彩评论

暂无评论...
验证码 换一张
取 消