Gracias de nuevo
no puedo hacer eso porque cada registro ocupa 46 Bytes y el ultimo byte del ultimo registro forma parte de un conjunto de 4 bytes que almacenar un valor del tipo long.
(La Base de Datos esta creada solo para un proposito y es el control de usuarios de mi programa)
Esta es la estructura:
2 Integer (Identificador del archivo)
2 Integer (Version del archivo)
2 Integer (Cantidad de datos)
x Datos
// DATOS
2 Integer (index)
16 String (Nombre)
16 String (Contraseña)
4 Long (Horas Acumuladas)
4 Long (Horas Usadas)
4 Long (Fecha)
Como Podras ver El ultimo byte podria tomar el valor del caracter que me propones.
De todas formas encontre como se podria llegar a hacer, encontre funciones de api que me podria ser utiles:
CreateFile
WriteFile
SetFilePointer
SetEndOfFile
CloseHandle
Pero todavia tengo que leer mucho porque hasta el momento solo consegui un ejemplo de como borrar los ultimos bytes de un archivo (Si! ya se que es lo que estaba buscando) pero no de como borrar algunos del medio, y no eh podido lograrlo, asi que sigo a la busqueda
Si te interesa aca de tedejo el ejemplo (a vos o a cualquiera que este leyendo esto):
GRACIAS IGUAL!!
'Example by Skuratovich Pavel aka P@Ssword (
[email protected])
'It is an example of use of function SetEndOfFile.
Option Explicit
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As Any) As Long
Private Declare Function SetFilePointer Lib "kernel32" (ByVal hFile As Long, ByVal lDistanceToMove As Long, lpDistanceToMoveHigh As Long, ByVal dwMoveMethod As Long) As Long
Private Declare Function SetEndOfFile Lib "kernel32" (ByVal hFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const GENERIC_READ = &H80000000
Private Const GENERIC_WRITE = &H40000000
Private Const FILE_SHARE_READ = &H1
Private Const FILE_SHARE_WRITE = &H2
Private Const OPEN_ALWAYS = 4
Private Const FILE_BEGIN = 0
Private Sub Form_Load()
Dim hFile As Long
Dim BytesWritten As Long
Dim Path As String
Path = "C:EOF.txt"
hFile = CreateFile(Path, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, OPEN_ALWAYS, 0, 0)
If hFile = -1 Then End
WriteFile hFile, ByVal "Very very cool & long string", 28, BytesWritten, ByVal 0&
MsgBox "View file 'C:EOF.txt', then click OK"
SetFilePointer hFile, 9, 0, 0
SetEndOfFile hFile
CloseHandle hFile
MsgBox "Now view file '" & Path & "' one more time"
Unload Me
End Sub
'CHICHO