Results 1 to 5 of 5

Thread: Writing in Binary

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    check out the left and mid functions

  2. #2
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    here's code that will work:
    VB Code:
    1. dim buff as string
    2. Open "C:\your file.txt" for binary as #1
    3. buff = space(500)
    4. get #1,,buff
    5.     open "C:\first part.txt" for binary as #2
    6.         put #2,,buff
    7.     close #2
    8. buff = space(200)
    9. get #1,loc(1),buff
    10.     open "C:\2nd part.txt" for binary as #2
    11.         put #2,,buff
    12.     close #2
    13. buff = space(lof(1))
    14. get #1,loc(1),buff
    15.     open "C:\3rd part.txt" for binary as #2
    16.          put #2,buff
    17.     close #2
    18. close #1

    test it and see if i had made any spelling mistakes in there.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  3. #3
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    Thumbs up kule

    I got it all working, thanks all for your help... Specially James Stanich for the speedy reply and 'B.P' cause that's exactly what I wanted, lol.
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  4. #4
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    yes it's amazing.... i didn't even write it in VB........
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  5. #5
    Fanatic Member jian2587's Avatar
    Join Date
    Aug 2000
    Location
    I bet u need a fusion powered shuttle to reach my place...
    Posts
    963
    Well, though the above method works, but I actually encourage
    u to do like this:
    VB Code:
    1. Open File1$ For Binary As #1
    2. FirstDat = Input$(500, #1)
    3. SecondDat = Input$(200, #1)
    4. 'ThirdDat could be retrieved in three ways
    5. ThirdDat = Input$(LOF(#1) - 700, #1)
    6. ThirdDat = Input$(LOF(#1) - (Len(FirstDat) + Len(SecondDat)), #1)
    7. ThirdDat = Input$(LOF(#1) - LOC(#1) + 1, #1)
    8. Close #1
    9. 'Write the dats to the corresponding files
    ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
    Programming is fun, but only if you're not on a tight deadline
    So I consider all those working engineers sad people

    VB FTP class
    3 page PHP crash course
    Crash Course on DX9 Managed with VB.NET covering basics till terrain creation

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