a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
Autodocs
 Libraries:
 dos.library
  AbortPkt
  AddBuffers
  AddDosEntry
  AddPart
  AddSegment
  AllocDosObject
  AssignAdd
  AssignLate
  AssignLock
  AssignPath
  AttemptLockDosList
  ChangeMode
  CheckSignal
  Cli
  CliInitNewcli
  CliInitRun
  Close
  CompareDates
  CreateDir
  CreateNewProc
  CreateProc
  CurrentDir
  DateStamp
  DateToStr
  Delay
  DeleteFile
  DeleteVar
  DeviceProc
  DoPkt
  DupLock
  DupLockFromFH
  EndNotify
  ErrorReport
  ExAll
  ExAllEnd
  ExNext
  Examine
  ExamineFH
  Execute
  Exit
  FGetC
  FGets
  FPutC
  FPuts
  FRead
  FWrite
  Fault
  FilePart
  FindArg
  FindCliProc
  FindDosEntry
  FindSegment
  FindVar
  Flush
  Format
  FreeArgs
  FreeDeviceProc
  FreeDosEntry
  FreeDosObject
  GetArgStr
  GetConsoleTask
  GetCurrentDirName
  GetDeviceProc
  GetFileSysTask
  GetProgramDir
  GetProgramName
  GetPrompt
  GetVar
  Info
  Inhibit
  Input
  InternalLoadSeg
  InternalUnLoadSeg
  IoErr
  IsFileSystem
  IsInteractive
  LoadSeg
  Lock
  LockDosList
  LockRecord
  LockRecords
  MakeDosEntry
  MakeLink
  MatchEnd
  MatchFirst
  MatchNext
  MatchPattern
  MatchPatternNoCase
  MaxCli
  NameFromFH
  NameFromLock
  NewLoadSeg
  NextDosEntry
  Open
  OpenFromLock
  Output
  ParentDir
  ParentOfFH
  ParsePattern
  ParsePatternNoCase
  PathPart
  PrintFault
  PutStr
  Read
  ReadArgs
  ReadItem
  ReadLink
  Relabel
  RemAssignList
  RemDosEntry
  RemSegment
  Rename
  ReplyPkt
  RunCommand
  SameDevice
  SameLock
  Seek
  SelectInput
  SelectOutput
  SendPkt
  SetArgStr
  SetComment
  SetConsoleTask
  SetCurrentDirName
  SetFileDate
  SetFileSize
  SetFileSysTask
  SetIoErr
  SetMode
  SetOwner
  SetProgramDir
  SetProgramName
  SetPrompt
  SetProtection
  SetVBuf
  SetVar
  SplitName
  StartNotify
  StrToDate
  StrToLong
  SystemTagList
  UnGetC
  UnLoadSeg
  UnLock
  UnLockDosList
  UnLockRecord
  UnLockRecords
  VFPrintf
  VFWritef
  VPrintf
  WaitForChar
  WaitPkt
  Write
  WriteChars
Include
GuruMeditation
Docs » Autodocs » dos.library » SetFileSize

NAME

	SetFileSize -- Sets the size of a file (V36)

SYNOPSIS

	newsize = SetFileSize(fh, offset, mode)
D0 D1 D2 D3
LONG SetFileSize(BPTR, LONG, LONG)

FUNCTION

	Changes the file size, truncating or extending as needed.  Not all
handlers may support this; be careful and check the return code. If
the file is extended, no values should be assumed for the new bytes.
If the new position would be before the filehandle's current position
in the file, the filehandle will end with a position at the
end-of-file. If there are other filehandles open onto the file, the
new size will not leave any filehandle pointing past the end-of-file.
You can check for this by looking at the new size (which would be
different than what you requested).
The seek position should not be changed unless the file is made
smaller than the current seek position. However, see BUGS.
Do NOT count on any specific values to be in any extended area.

INPUTS

	fh     - File to be truncated/extended.
offset - Offset from position determined by mode.
mode - One of OFFSET_BEGINNING, OFFSET_CURRENT, or OFFSET_END.

RESULT

	newsize - position of new end-of-file or -1 for error.

BUGS

	The RAM: filesystem and the normal Amiga filesystem act differently
in where the file position is left after SetFileSize(). RAM: leaves
you at the new end of the file (incorrectly), while the Amiga ROM
filesystem leaves the seek position alone, unless the new position
is less than the current position, in which case you're left at the
new EOF.
The best workaround is to not make any assumptions about the seek
position after SetFileSize().

SEE ALSO

Seek()

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Razor 1911

RBS
RZR
SCX
FLT

Comments:

$VER: d0.se 1.14 Copyright © 2011-2024 Tobias Geijersson support at d0 dot se