Results 1 to 7 of 7

Thread: Line input

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242

    Arrow

    Hello!

    I use Hoffman algorithm to compress string. It adds vbCr at the beginning of compressed string's header. Then I want to load that string from file. In notepad I see all text in one line so I used Line Input # statement. But I realised that I was wrong, because Line Input accepts vbCr as enter (new line), so it ends here even if it has read just 2 charachters.

    How can I read whole line without using Line Input # statement which doesn't work?
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    Just adding:

    In compressed string are also vbLf constants - Chr(13) and these are also supposed to be new line (for VB).
    The thing I need is that then new line can be there where are both characters (vbCrLf).
    Looping through all file, finding it, retrieveing it and decompressing would be useless (100k file) and it would take a long time. Any suggestions?
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  3. #3
    Guest

    Red face

    fyi:
    vbLF = chr(10), not 13!

  4. #4
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    Just read the entire file into a string.
    Code:
    Dim sFile As String, btFileNum As Byte
    
    btFileNum = FreeFile
    Open "C:\A\B\C\D\E\F.G" For Input As btFileNum
        sFile = Input(LOF(btFileNum), btFileNum)
    Close btFileNum
    
    ' Now, the string sFile contains the entire contents of the file

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    And if I read all file to string, then I can split it, isn't that right?
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  6. #6
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    You can try!

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

    <?>

    You can if you have somthing to split on.

    Split() Function in VB
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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