CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2001
    Posts
    5

    Weird Problem with ReadAll method

    Hi,

    I wrote a simple function to read data from a text file:

    Dim buffer as string
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.OpenTextFile(filename, ForReading, -2)
    buffer = f.Readall
    f.Close

    The weird thing is an extra newline character for every row of data is always added for no apparent reason. Example:

    Source File:
    123456
    1234567890

    Buffer: "123456nn1234567890" where n=newline character

    Anybody know why?

    Any input is greatly appreciated!

    Rgs
    WT


  2. #2
    Join Date
    Aug 2001
    Posts
    5

    Re: Weird Problem with ReadAll method

    Sorry, make a mistake, it problem should be extra space padded for every row of data.

    Source:
    123456
    1234567890

    buffer: "123456ns1234567890" where n=newline s=whitespace

    Sorry about that.

    WT


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