En este ejemplo practico el fichero debe tener un tamaño superior a 1000 byte:
Library "libc:6"
' int truncate (const char *__file, __off_t __length)
' Truncate FILE to LENGTH bytes.
Private Extern truncate(__file As String, __length As Long) As Integer
Public Sub Main()
Dim err As Integer
' Preserva los primeros 1000 byte del archivo:
err = truncate("/ruta/del/archivo", 1000)
If err < 0 Then Error.Raise("Imposible truncar el archivo !")
End
' int truncate (const char *__file, __off_t __length)
' Truncate FILE to LENGTH bytes.
Private Extern truncate(__file As String, __length As Long) As Integer
Public Sub Main()
Dim err As Integer
' Preserva los primeros 1000 byte del archivo:
err = truncate("/ruta/del/archivo", 1000)
If err < 0 Then Error.Raise("Imposible truncar el archivo !")
End