New line characters in the file writing

I use the following function to write text in the file

public void DebugLog (String strTxt)
{
System.Err.println (strTxt);
System.Err.println("\r\n");
   
Try
{
String iFileName = "file:///SDCard/BlackBerry/pictures/Debug.log";
FileConnection fileConn = (FileConnection) Connector.open (iFileName, Connector.READ_WRITE);
If (fileConn! = null)
{
If (! fileConn.Exists ())
fileConn.create ();
               
OutputStream os = fileConn.openOutputStream (fileConn.fileSize ());
DataOutputStream back = new DataOutputStream (os);
dos.writeChars (strTxt);
back. Close();
fileConn.close ();
}
}
catch (Exception ex)
{
}
}

The function above very well written text to file. But when the txt contains \r\n which is not reflected in the line break in the file. He appears just as \r\n in the file.

What changes I need to make sure that the line break is refrlected correctly in the file. I need to convert any other sequence of bytes using a Unicode conversion, \r\n

try to use

dos.writeUTF

Tags: BlackBerry Developers

Similar Questions

  • New line number in text file in Notepad open

    Hi all,

    Create a text file using the procedure and moved to the FTP folder. Text file opened through IE its working very well. Copied to the local computer and open in Notepad, its not work i.e., appeared in a continuous line. Return the correct sound also verified text only

    Code:

    Declare

    Begin

    v_File_Name: = utl_file.fopen (Dir_Obj_Name, filename, 'W');

    For Cur In (Select "A" A1, A2 'Two', 'Three' A3 double)

    Union

    Select 'Four', 'Five' A2, A3 A1 "Six" double

    )

    Loop

    v_line_Text: = Cur.A1 | ' ' || Cur.A2 | ' ' || Cur.A3 | ' ' || Chr (13).

    UTL_FILE.put_line (v_File_Name, v_line_Text, True);

    End loop;

    UTL_FILE.fclose (v_File_Name);

    End;

    Ouput except

    One two three

    Four five Six

    BoopathiL wrote:

    Hi all,

    Create a text file using the procedure and moved to the FTP folder. Text file opened through IE its working very well. Copied to the local computer and open in Notepad, its not work i.e., appeared in a continuous line. Return the correct sound also verified text only

    Code:

    Declare

    Begin

    v_File_Name: = utl_file.fopen (Dir_Obj_Name, filename, 'W');

    For Cur In (Select "A" A1, A2 'Two', 'Three' A3 double)

    Union

    Select 'Four', 'Five' A2, A3 A1 "Six" double

    )

    Loop

    v_line_Text: = Cur.A1 | ' ' || Cur.A2 | ' ' || Cur.A3 | ' ' || Tank (13);

    UTL_FILE.put_line (v_File_Name, v_line_Text, True);

    End loop;

    UTL_FILE.fclose (v_File_Name);

    End;

    Ouput except

    One two three

    Four five Six

    Well, your code is not still valid in the first place.

    There is no function called "tank", the real function is "chr".

    The character for a new line character is Chr (10) rather than Chr (13).

    In unix operating systems, the line break is just Chr (10).

    Operating systems windows/dos line break is Chr (13) | Chr (10), although some windows applications such as Word/Wordpad will understand * nix style chr (10) is like the newlines too, however, things like Notepad will not and will eventually display all data on a single line.

    When you transfer a text file of a unix operating system to an operating system of windows that it is usually performed using FTP and you need to make sure you put the software FTP in ASCII mode so that the new line characters get converted correctly...

    FTP > CSA

    200 type set to A.

    (for binary files, you ensure that the FTP is set to binary mode so that no byte in the file is corrupted by such a conversion).

    By transferring your file using FTP ASCII mode, from unix to windows, the characters Chr (10) in the file will be converted to Chr (13) | the pairs of characters Chr (10), then the file will be displayed correctly in Notepad.  If you transfer from windows to unix in ASCII Chr (13) | Chr (10) pairs are converted back to just chr (10) for unix.

    As an alternative, there's also a Unix utility called "unix2dos" which converts a text file from unix style returns to the line of back style line breaks, then you simply transfer the file in binary mode, so no other conversion takes place.

  • Other new lines in SQL script file and problem with SQL * more

    Hi all


    I would like to ask a question on the characters of new line inside files SQL scripts. I have a very long SQL query, stored in a file txt (ANSI encoding). Because query instructions are very long (several table joins and WHERE conditions) tried to separate, WHERE and ORDER BY clauses by inserting several new characters of lines (just hit the entrance) among them in order to improve the clarity of the source code. Now the problem is, whenever these newline characters are inserted in the file, apparently SQL * Plus cannot parse the file properly and gives me the following error message:
    SP2-0042: unknown command "FROM" - rest of line ignored.
    SP2-0734: unknown command beginning "myenterpri..." - rest of line ignored.
    The problem is definitely related to these new line because characters that when I remove them, the scripts runs without any problem. I would appreciate that you could kindly guide me how should I deal with this problem. Is there any SQL * Plus command to run to correctly interpret the new line characters?


    Thanks in advance,


    Kind regards
    Dariyoosh

    Hello

    In [SQL * Plus 9 | http://download.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1013073] (and), you can tell

    SET     SQLBLANKLINES   ON
    

    allow to completely empty rows in an SQL statement.

  • It doesn't seem as if it was possible to have new line characters in a flex alert popup?

    It doesn't seem as if it was possible to have new line characters in a flex alert popup?

    I'll send strings of coldfusion as follows:

    'ncy bank\n"'

    Hmm, it seems there is a problem of coldfusion, if the chain is made of flex side there is no problem

    Hello

    In the string event.result replace characters \n by Chr (10).

    & Chr (10) & 'new new line' >

    It will work.

    Hope this helps you.

  • In windows mode 8, when I need to save a file (photo), I can't make a new folder to save the file.

    In windows mode 8, using Hotmail app, I don't have the opportunity to make a new folder to save an attached file in an email.

    Hi Lince,

    Please answer this question to get more clarity on this issue.

    -You talk to the Mail app?

    If you are referring to the Mail application, then by saving an attachment of an e-mail can be done in a folder on the computer. So, if you want to create a new folder to save the file attachment, you must create it before you download the attachment of the e-mail.

    Response with the State of the question and we will be happy to offer you our help.

  • How can I remove the first 3 characters of the files?

    I'm using the bridge for a while and rename the lot

    How can I rename to remove the first 3 characters of the files?

    (these are numbers)

  • problem - by clicking on the button loses the new line or resets the iterator

    Hello

    I use JDev 11.1.1.6. I created a page that is preceded in the taskflow by a method in the AppModule that creates a line on the iterator and inserts it. I have a button 'Next' in the page, which is supposed to make changes to attribute readonly on the input fields, and display a confirmation button.

    The problem: when I click on 'next', the empty fields that have been entered by the user on the page, is part of the first record in the iterator. It is as if, when the button "Next" has been clicked, the iterator has been somewhat refreshed and moved to the first original line, and entered values have been thrown in there... While my 'new' record is lost. Result: I lose my new record line, and entered values replace the values in the first previous row in the iterator.

    The code used to create the line before the page is loaded:

    Sender ViewObjectImpl = getSubmittersView3_1();

    Submitter.Reset ();

    ViewRowImpl submitterRow = submitter.createRow () (ViewRowImpl);

    submitter.insertRow (submitterRow);

    When the page is loaded initially, I printed the primary key on the line and a - 4 (which is good, it means new line)

    But when I print the primary key in the action of the button 'Next', 59, who has been the pharmacokinetics of the first original line I.

    The code that is used to print the primary key:

    seqNum int = Integer.parseInt (this.getAppModule () .getSubmittersView3_1 () .getCurrentRow () .getAttribute (0) m:System.NET.SocketAddress.ToString ());

    Then print seqNum.

    Please help.

    Found the problem.

    I had a button print at the bottom, which was my button "Cancel". In this paper, I got the code to remove additional items (i.e. unwanted ranks - since it is a Cancel button). And what was going on was that while rendering on the page, the code of the EEG for the go button was running and the removal of my new line! If the culprit here was go get code button is iterated in the rendering phase... something I didn't expect or know so far. Remove this code and change a command button solves the problem.

  • Given the file name or path contains Unicode or DBCS characters. Retry using ASCII characters for the file name and path whatever that means? This happens when I publish an OAM

    Given the file name or path contains Unicode or DBCS characters. Retry using ASCII characters for the file name and path

    What does that mean? It happens when I try to publish an OAM for Dreamweaver.

    Also: How can I specify the onboard browser animate? It's just going as far. Are there no preference to animate it dashboard?

    BTW. Just call him edge. Seriously. You call Illustrator draw? Photoshop editing?

    No, my file name is mainContent.oam

    My project name is mainContent.an

    This error occurs when I try to import into Dreamweaver. Sorry, I was unclear about that earlier.

    I thought maybe it was because I had saved my image as a png image. So re-saved as an svg, still get the error.

    Should I have a setting is CC of Dreamweaver that will not? I should try this in Dreamweaver CS6? I might try that next.

    Why is this so difficult program? I know that Flash. I know that After Effects. I can work the chronology part simply awesome. He's still export I have problems.

    On a MacPro, 10.7.

    You are a person of Adobe or simply a beautiful assistance program?

  • New line disappears in the table

    I add the new line at my table:

    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
             DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("PrfItemImageTempVO1Iterator");
             RowSetIterator rsi = dciter.getRowSetIterator()
             Row newRow = rsi.createRow();
             newRow.setNewRowState(Row.STATUS_INITIALIZED);
             rsi.insertRowAtRangeIndex(0, newRow);
             rsi.setCurrentRow(newRow);
    
    

    then add information on the same line, but the line "disappears." However if I commit it is recorded in the database.

    In other words, for each line of the table I can download files. When I download fill the line with the name, the address, the ID of the article to which has been added and its action (insert, update, delete).

    The point is that the line is added but quanho that you enter this information disappears. Although in my impressions, print the correct information.

    If you commit information is also stored in the database.

    I try to update the table, run the query, partial trigger and nothing works.

    2780557 wrote:

    After I clicked on the button DOWNLOAD and add a file on my server and add line information.

    I guess some of these activities is the "walk away" (refresh the table in the database where your changes are not validated)

    As attilas79 suggested, why not try the standard buttons/operations instead of creating the new line by programming?

  • First characters of the file name to create a folder name

    Hello

    I need to use the first characters in a file name given to underscore image to create a folder name in which the image will be so recorded.

    I already use the slice method to fly out of the file extension and some other stuff but seeing that the image names and the code initially aren't all the same length I need another method allowing to identify underscore.

    var ChronoFolderName = app.activeDocument.name.insert_magic_method_here;

    Any ideas?

    Thanks in advance

    Neil

    Use the distribution. This will create a table filename parts which are separated by the underscore character. If you have several traits underscore, you can loop together to get the desired length. I normally just a division that separates the the frame number job number, so I just put [0] after the separation and it captures all the information to the first line of underscore.

    var newName = doc.name.split('_');
    
  • Cannot read Document in FileUtilities to search a file with french characters in the file name

    Hello

    I'm looking for a file with french characters in the filename as"ecran.doc" in my unix Server directory and write the file somewhere, say, in a list of documents, or write to files to another directory.

    I use to read Document in FileUtilities of the Foundation, but it cannot read the file due to the french character in its name. Although it can find another name of file without these french characters.

    I tried to rename but who also can not find the file with the name of the french character.

    Please provide any idea to solve using LC operation.

    Kind regards

    Raj of Rohan.

    Hi Thomas,

    Thanks for the post, but I already found a solution to this a month ago. Sorry for not posting the solution.

    Just put the '-Djava.property.file.encoding = ISO8859-1' in your server startup JVM argument and position the rebound on the back of the server to choose the new JVM arg . And now the reading service of Document in FileUtilities of the Foundation read characters all french.

    ISO8859-1refers 'no. 1 Latin alphabet,"consisting of 191 characters from the Latin alphabet. This character encoding scheme is used throughout the Americas, Western Europe, Oceania, and much of Africa. It is also commonly used in most of the Etymologies of the East Asian languages.

    Kind regards

    Raj of Rohan.

  • Problems opening some jpg files in a new window - allow saving the file

    It looks more a problem of question instead of the Web browser, but can you tell me if there might be a Firefox framework that affects this behavior?
    When you shop for online leads, I often open different color pictures in windows separated to see who looks better together.
    I came across a page that does not allow me to do that for a lot of these images - instead, the message appears:
    > You have chosen to open:
    >. zoom.1.jpg [filename]
    > which is: binary file
    > from: http://cdno1.yarn.com
    > you want to save this file?
    > Cancel / save file
    The page is http://www.yarn.com/webs-anniversary-sale-weaving-yarns/webs-weaving-yarns-valley-yarns-rayon-chenille/. To assume the error, I hit ctrl + enter while the cursor is over the image of the hourglass, and then select or open the link in new tab (or window). Copy the link of the image and it enter in the URL bar also evokes the same error message for the articles in question.
    I added 'yarn.com' and 'cdno1.yarn.com' to my list of exceptions for the popup blocker, but has not made a difference or doesn't open Firefox in Mode without failure.

    I recently had to delete and reinstall my laptop OS, so I lost my preferences for Firefox and I am trying to sort and correct any unexpected behavior. I am currently using Mac OS X 10.6.8 and the latest version of Firefox. (I can't access this information in Mode without failure, but 38.0 sounds right.)

    Any help is appreciated.

    The server sends the files in Content-Type: application/octet-stream
    Who will be present the Firefox download dialog box.

    You can watch this extension:

    As an alternative, you can use a bookmarklet to keyword (e.g., img) like this:

    data:text/html,<img%20src='%S'>

    You can call the bookmarklet via the address bar:

    img http://cdn01.yarn.com/resources/Yarn/images/products/processed/1331.GRAYBLUE.zoom.1.jpg
  • A new line appears in the messages I receive. There seems to be a line of links, including a Pointant URL to the source of msg (maybe). How can I get rid of him?

    On my messages incoming under my bars, & above the message header, is a new line. It sort of looks like another bar tools, but different. It reads from left to right, and each word is white highlight:

    Return before refresh URL: _ go

    Each of these words except for "URL:" are in boxes as if they are links, but they do not work as links.

    What is this and how do I get off it my incoming messages?

    Thank you, nanciewanda

    OK, you have a lot of Add-ons, I though I had loads, but I think that you beat me.

    You have the add-on Thundebirowse installed, I think that the elements are in the toolbar that provides.

    Tools menu > Add-ons and disable Thunderbrowse and I think they will disappear.

  • Replaced the motherboard and the HARD disk and now you try to transfer the old TB on the new, but cannot locate the files on the HARD old disk which is now the drive 'E '.

    My computer has stopped working completely and I was going to upgrade in any case, I advanced the work.
    Having replaced everything (motherboard, HARD drive) and everything worked as it should I turned my attention to my emails.
    I tried the Transfer Wizard Windows 7, no joy. Tried to find the profile files, no joy. Just can't find anything about it either remote seems to be linked to tuberculosis.
    HELP Please
    Thank you

    Profile of Thunderbird folders are hidden files, so first make hidden files visible.
    http://KB.mozillazine.org/Show_hidden_files_and_folders

    The location of the profile: http://kb.mozillazine.org/Profile_folder_-_Thunderbird
    Even if your files are now in drive E, not C.

    Info on moving to a new pc: http://kb.mozillazine.org/Move_to_a_new_PC

    If you have downloaded Thunderbird to new pc and run it for the first time, it will create a profile, but do not create the exisitng e-mail accounts. Then you copy the contents of the old drive hard e: drive - profile folder (not the folder real profile, that all the files in the profile folder) and paste them into the profile folder overwrite the default files.

  • I created a new profile and copied the files from my old computer inside firefox. How do the new profile, just delete the old one?

    I am running windows 7, I had to recover my files on an external hard drive when my old computer crashed. I created a new profile as described in the Web site of firefox and copied all the files into it. I just need to know how to use the new profile when I open firefox, just delete the old profile? Or do I have to reinstall firefox.

    If you no longer have need or intention to use this older profile, then you can use the Profile Manager to delete this profile and delete the files.

Maybe you are looking for

  • I can't get the Media Creator to work

    I can't get the Media Creator to work.I installed it and it does not open.Suggestions anyone?

  • Resize the Windows Server 2003 boot partition

    My client has Server 2003 with a RAID. The system volume / start is 12 GB. Right next to this boot on the partition volume is 30 GB of unallocated space. The rest of the disk is allocated to a separate partition in which all their data lives. Can I e

  • reparar error 0x80072EFE en xp

    Necesito UN reparar el error 0x80072efe en xp

  • w2207 USB ports

    My flat screen HP w2207 monitor has 2 USB ports on the side, but I can't determine whether or not they are powered.  I am trying to connect my IPod to one of the USB ports on the monitor for loading or synchronization with iTunes and nothing happens.

  • How can I configure via Bluebeam PDF to preview in the preview of Windows 8 pane?

    In windows 7, you can set the Preview file tree pane to preview a PDF file when you click on it once. In windows 8, this does not work, even when you set the view organize in the preview pane and the player to the default player. All solutions? Blueb