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 » FGets

NAME

	FGets -- Reads a line from the specified input (buffered) (V36)

SYNOPSIS

	buffer = FGets(fh, buf, len)
D0 D1 D2 D3
STRPTR FGets(BPTR, STRPTR, ULONG)

FUNCTION

	This routine reads in a single line from the specified input stopping
at a NEWLINE character or EOF. In either event, UP TO the number of
len specified bytes minus 1 will be copied into the buffer. Hence if
a length of 50 is passed and the input line is longer than 49 bytes,
it will return 49 characters. It returns the buffer pointer normally,
or NULL if EOF is the first thing read.
If terminated by a newline, the newline WILL be the last character in
the buffer. This is a buffered read routine. The string read in IS
null-terminated.

INPUTS

	fh  - filehandle to use for buffered I/O
buf - Area to read bytes into.
len - Number of bytes to read, must be > 0.

RESULT

	buffer - Pointer to buffer passed in, or NULL for immediate EOF or for
an error. If NULL is returnd for an EOF, IoErr() will return
0.

BUGS

	In V36 and V37, it copies one more byte than it should if it doesn't
hit an EOF or newline. In the example above, it would copy 50 bytes
and put a null in the 51st. This is fixed in dos V39. Workaround
for V36/V37: pass in buffersize-1.

SEE ALSO

FRead(), FPuts(), FGetC()

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:

The Black Lotus

PHA
TBL
ANA
RBS

Comments:

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