CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: TextArea()

  1. #1
    Join Date
    Sep 1999
    Posts
    7

    TextArea()

    I need a file viewer.
    Following is partial code.
    Everything is ok if the file is NOT too big.
    If a file is big such as one of my test case, length = 185191, the TextArea is empty.

    This is happening on win95. No problem in winnt.
    I feel this is a JAVA bug.(?) But I need a work around.

    Please help. Thanks you very much.


    ===============================================
    File f = new File(file_name);
    BufferedReader br =
    new BufferedReader(new FileReader(f));

    long size = f.length();
    System.out.println( " f.length=" + size );
    int sz = (int) size;
    char[] cbuf = new char[sz];
    int n = br.read( cbuf, 0, sz );
    TextArea ta= new TextArea( new String(cbuf), 24, 20);
    ......

    Anna Chou

  2. #2
    Join Date
    Sep 1999
    Location
    Madurai , TamilNadu , INDIA
    Posts
    1,024

    Re: TextArea()


    String cant hold more than 64K. So , create a char array that is less than 64K and
    append it in the TextArea.


  3. #3
    Join Date
    Sep 1999
    Posts
    7

    Re: TextArea()

    Thank you very much.
    I tried what you suggested. Only append 64k at a time to the TextArea. But it did not work.
    The problems I think are in the TextArea display.
    I have checked the length of the text in the TextArea at the end. It equals to the file length which just read in. I still got a blank display in the case of file length > 64k.

    Any more suggestions for work around?
    ( Same code works find in winnt )



    Anna Chou

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured