Results 1 to 9 of 9

Thread: Print #filenum doesnt do it immediately??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Posts
    70
    Hi guys,
    I have a logging function that will log anything i choose to the logfile, i have a bit of a problem with it..
    all it does is use PRINT #File to output to the file..
    the logfile will print to a certain point (halfway through a line) then stop, until i close my program.. it goes thru the print statement, i checked.. it just wont do it immediately... anyone know a solution.. code is below for my log function btw..
    Code:
    Public Function do_log(message As String)
    If Not NOLOG Then Print #LogFile, Format(Date, "mm/dd/yyyy") & " " & Format(Time(), "hh:nn:ss") & " " & message
    End Function
    Ok, update, It now doesnt output _anything_ until i close the form.. (it did before, just missed about 3 lines) any ideas?

    [Edited by CAPHS on 10-14-2000 at 07:03 AM]
    Daniel Rose
    VB 5.0 Enterprise.
    irc:irc2.dynam.ac

    If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Did you use the open and close #LogFile? this will close the file, it writes immediatly in my case!

    Close #filenumber > will only close the specified filenumber
    Close > will close all the open files.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Posts
    70
    i didnt use close yet, no, because i open LogFile at the very start of my prog, and it remains open throughout.. so i can simply call the function anytime(this isnt a big problem, i just noticed it and want to fix it if i can) i figure it must be that i dont close it between each right eh?
    Daniel Rose
    VB 5.0 Enterprise.
    irc:irc2.dynam.ac

    If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()

  4. #4
    Guest
    it may depend on the method you have used to open the file in the first place. If you use the Locked / Read Write keywords, or you have done a combination of these, then you may not be able to open the file (in notepad for example) until you have used the close statement.

  5. #5

  6. #6
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    hehe Marty, we're talking about 'printing' to a file.. you know
    CAPHS, yeah, when you don't use close, you don't notice any updates in the file I think, until you do close #fn.

    Hope you got it to work now (damn I drink to much!)
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  7. #7

  8. #8
    Lively Member
    Join Date
    Oct 2000
    Location
    Singapore
    Posts
    98
    Ever considered using a database as a log? U definitely have other parameters to upkeep?

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    It seems like your buffering's getting confused. VB has told Windows to write the data, but it hasn't sent enough, so the buffer needs to be flushed...not that I know how...
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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