How do I flush the write buffer after a write without closing and reopening the file?
Wow. That one made me think. The solution is to use pure API Calls to create the file. Which means, forget about the whole:
open "yada.txt" for input as #1 'Stuff close #1
You'll Have to use:
public Const GENERIC_WRITE = &H40000000 public Const GENERIC_READ = &H80000000 public Const FILE_ATTRIBUTE_NORMAL = &H80 public Const CREATE_ALWAYS = 2 public Const OPEN_ALWAYS = 4 public Const INVALID_HANDLE_VALUE = -1 public Declare Function ReadFile Lib "kernel32" _ (ByVal hFile As Long, lpBuffer As Any, _ ByVal nNumberOfBytesToRead As Long, _ lpNumberOfBytesRead As Long, _ ByVal lpOverlapped As Long) As Long public Declare Function CloseHandle Lib "kernel32" _ (ByVal hObject As Long) As Long public Declare Function WriteFile Lib "kernel32" _ (ByVal hFile As Long, lpBuffer As Any, _ ByVal nNumberOfBytesToWrite As Long, _ lpNumberOfBytesWritten As Long, _ ByVal lpOverlapped As Long) As Long public Declare Function CreateFile Lib _ "kernel32" Alias "CreateFileA" _ (ByVal lpFileName As String, _ ByVal dwDesiredAccess As Long, _ ByVal dwShareMode As Long, _ ByVal lpSecurityAttributes As Long, _ ByVal dwCreationDisposition As Long, _ ByVal dwFlagsAndAttributes As Long, _ ByVal hTemplateFile As Long) As Long public Declare Function FlushFileBuffers Lib "kernel32" _ (ByVal hFile As Long) As Long
Then use them in the code to open, write, flush, write and close the file.... I've always been a personal fan of the API :)
Thanks Comatose...you must be awesome when you are awake:)
guess it's time to take the plunge
i am trying to create a library management system which is supposed to be used to store/keep infp for the library and the library members( book title, author, name and picture for borrower and other stuffs). The app has 6 buttons, delete, save, add,previsous,next, and upload( for upload ...
Im trying to bind my custom vertical scrollbar to datagridview is this possible.. Please help Thnak you..
I have two tables, I will call them first-half and second-half (of the year)
Table: first id jan feb mar apr ----------------------- 2 80 90 70 60 3 50 40 60 30 Table: second id jan feb mar apr ----------------------- 2 50 70 60 90 3 80 60 50 ...