Unit 'AmigaDOS' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#morphunits]

SplitName

splits out a component of a pathname into a buffer

Declaration

Source position: amigados.pas line 1912

function SplitName(

  name: PChar;

  separator: Cardinal;

  buf: PChar;

  oldpos: LongInt;

  size: LongInt

):SmallInt;

Arguments

name

  

Filename being parsed.

buf

  

Buffer to hold separated name.

oldpos

  

Current position in the file.

size

  

Size of buf in bytes (including null termination).

Function result

New position for next call to splitname. -1 for last one.

Description

This routine splits out the next piece of a name from a given file name. Each piece is copied into the buffer, truncating at size-1 characters. The new position is then returned so that it may be passed in to the next call to splitname. If the separator is not found within size characters, then size-1 characters plus a null will be put into the buffer, and the position of the next separator will be returned.

If a a separator cannot be found, -1 is returned (but the characters from the old position to the end of the string are copied into the buffer, up to a maximum of size-1 characters). Both strings are null-terminated.

This function is mainly intended to support handlers.

See also

FilePart

  

Returns the last component of a path

PathPart

  

Returns a pointer to the end of the next-to-last component of a path.

AddPart

  

Appends a file/dir to the end of a path


Documentation generated on: 2021-07-30