Results 1 to 3 of 3

Thread: problem in input string

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    baroda, india
    Posts
    12

    Exclamation problem in input string

    hi,
    i am reading a file & writing to other file but i found that output file have more characters then input file. my code is as follows, any one test with their file & give me some sugguestion.
    Private Sub Command1_Click()
    Dim tfile As String
    Dim ofile As String
    Dim outfile As String
    Dim intf As Long
    Dim intf1 As Long
    intf = FreeFile
    tfile = "c:\temp\iii.hex"
    intf = FreeFile
    Open tfile For Binary Access Read As #intf
    outfile = Input(LOF(intf), #intf)

    ofile = "c:\temp\177.hex"
    intf1 = FreeFile
    Open ofile For Output As #intf1
    Write #intf1, 1, outfile;
    Close #intf1
    Close #intf
    End
    End Sub

    thanx

    arunpatel
    arun

  2. #2
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    If you are using Binary access, you shouldn't use the input statement. You should use Get instead. Try this:

    VB Code:
    1. Dim tfile As String
    2. Dim ofile As String
    3. Dim outfile As String
    4. Dim intf As Long
    5. Dim intf1 As Long
    6. intf = FreeFile
    7. tfile = "c:\temp\iii.hex"
    8. intf = FreeFile
    9. Private Sub Command1_Click()
    10.  
    11. Open tfile For Binary As #intf
    12. Get #intf, , outfile
    13.  
    14. ofile = "c:\temp\177.hex"
    15. intf1 = FreeFile
    16. Open ofile For Binary As #intf1
    17. put #intf1, , outfile
    18. Close #intf1
    19. Close #intf
    20. End
    21. End Sub
    <removed by admin>

  3. #3
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    Why did you repost your question? It was already answered here by 3 people.
    http://www.vbforums.com/showthread.php?threadid=97878
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

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