Results 1 to 4 of 4

Thread: Simple way to Read the Whole File?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    hongkong
    Posts
    251
    Dear Friends,
    Long time no see. greetings.

    I wish to ask a stupid question but I really don't know. Is it the following statement can read the whole file into the string variable Buffer?

    Dim buffer as string
    Open "c:\temp.txt" For Binary As 1
    Get #1,,Buffer
    Close 1

    By the way, if I wish to set the file pointer to the start, is it the following?

    Seek #iFileHandle, 1

    Thanks a lot.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Code:
    Dim buffer as string 
    Open "c:\temp.txt" For Binary As #1
        Get #1,,Buffer 
    Close 1
    That will read in the whole file yes.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Dim buffer as string
    Open "c:\temp.txt" For Binary As 1
    Get #1,,Buffer
    Close 1

    'to answer your own question

    Debug.Print Buffer

    and see what you get.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    hongkong
    Posts
    251

    Afraid of Overflow or Slow System Response

    In fact, I will download some data from the Web. If the data size can be up to 2M or so but I just append the data to a string, will this cause problems to my program.

    BufferString=BufferString+ReceivedData


    If I run the "Replace" function on such a big string, will it OK?

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