xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_FNameSplit()

Splits a file name into individual components.

Syntax

HB_FNameSplit( <cString>      , ;
               [@<cPath>]     , ;
               [@<cFileName>] , ;
               [@<cExtension>]  ) --> NIL

Arguments

<cString>
This is a character string to split into different components of a file name.
@<cPath>
If specified, <cPath> must be passed by reference. It receives the path component for a file as a character string.
@<cFileName>
If specified, <cFileName> must be passed by reference. It receives the name component for a file as a character string.
@<cExtension>
If specified, <cExtension> must be passed by reference. It receives the file extension as a character string.

Return

The function returns always NIL. The components of a file name are assigned to the parameters passed by reference.

Description

Function HB_FNameSplit() is used to split a full qualified file name into individual components. They can be merged later with function HB_FNameMerge().

Info

See also:CurDir(), CurDrive(), Directory(), File(), HB_FNameMerge()
Category: Character functions , File functions , xHarbour extensions
Source:rtl\fnsplit.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The function splits a full qualified file name and
// displays the result

   PROCEDURE Main
      LOCAL cString := "C:\xhb\source\data\test.dbf"
      LOCAL cPath, cFileName, cExtension

      ? HB_FNameSplit( cString, @cPath, @cFileName, @cExtension )

      ? cPath                // result: C:\xhb\source\data\
      ? cFileName            // result: test
      ? cExtension           // result: .dbf

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe