×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Apr 2005
    Posts
    162

    How to make a carriage return?

    Hi Symbies,

    There'e a little problem (I think I get crazy time by time).
    In C it's so easy to make a carriage return: printf("\n");
    But what's up with C++ for Symbian?
    My Code:

    _LIT(Kx1,"%d ");
    TBuf<5> bufx;
    TBuf8<10> buf8;
    for(iX=0; iX<iY; iX++)
    {
    gray = myArray[iX];
    bufx.Format(Kx1, gray);
    buf8.Copy(bufx);
    fInput.Seek(ESeekCurrent, offset);
    fInput.Write(buf8);
    }

    The only thing I do, is to write the integer-values of an array into a file. That works fine.
    Here's a copy of the file:

    111 0 0 119 255 255 255 255

    But now I want to fill in some carriage returns (say after every third cycle of the loop).
    That means 13 (for '\n'). But how to assign the control character?
    The write()-method wants a buffer-deskriptor.
    So my question is, how to break the lines?

    Best regards
    Christian

  2. #2
    Registered User
    Join Date
    May 2005
    Posts
    13

    Try This..

    try this..

    instead of '\n', use '\r\n'..

  3. #3
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122
    I assume you want a newline i.e. linefeed and not just carriage return (go to beginning of current line). LF "\n" works fine in Symbian, there's no need to use MSDOS style CRLF "\r\n". Depending on the context, you may need to wrap it into a TChar or a descriptor. For example in your code, bufx.Append( TChar( '\n' ) ).

    Lauri

  4. #4
    Regular Contributor
    Join Date
    Mar 2005
    Location
    Bangalore,India
    Posts
    306
    CEditableText::ELineBreak can do job for u

  5. #5
    Regular Contributor
    Join Date
    Apr 2005
    Posts
    162
    Hi,
    First I have to thank you for trying to help me.
    @laa-laa: Itried this too, but I opened my txt-file always with an ascii-editor. And that was the problem...
    I only saw special character...
    The problem wasn't Symbian, the problem was f***in' windows-standard-editor and my shortsighted brain...
    Using CEditableText is a little bit too complex for that process, but also thanks for that hint (maybe it is convenient for later usage).

    Thanks guys!!

    Christian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •