.FILE SPLIT FILENAME

This subroutine is called to separate a filename into it's name and extension parts.


Usage:

      PASS         <filename_part>            FIELD            SHARE? Y
      PASS         <extension_part>           FIELD            SHARE? Y
      PASS         <full_filename>            FIELD            SHARE? N
      GOSUB    --- .FILE SPLIT FILENAME
      *        check for errors
      IF       --- .FILE SPLIT FILENAME      NE

Description:

This subroutine is called to separate a filename into it's name and extension parts. All parameters are required, if any are missing the subroutine will CANCEL.

<filename_part> will contain the filename part (Required). This must be PASSed with Share "Y".

<extension_part> will contain the file extension part, including its leading period (Required). This must be PASSed with Share "Y".

<full_filename> is the full filename to separate (Required).

The subroutine identifies the <extension_part> by locating all the characters after the last period in <full_filename>. If there are no periods in <full_filename>, then <full_filename> will be returned in <extension_part> and <filename_part> will be empty (the entire name is considered the extension). If <full_filename> contains a leading path, that will also be returned in <filename_part>. See .FILE SPLIT PATHNAME to split the pathname from the base file name.

A 'Data was truncated' error will be returned in .FILE SPLIT FILENAME if the fields you pass are too short to contain either the file name or file extension.

Comments:

Read what other users have said about this page or add your own comments.


-- PeteBrower - 2011-08-12

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r5 - 2013-10-28 - AlKalter
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback