'8.3 format file name'에 해당되는 글 1건

  1. 2007/09/10 From/to the 8.3 (short) format to/from the long format
2007/09/10 16:21

From/to the 8.3 (short) format to/from the long format

This unit provides two functions that convert filenames from the long format to the 8.3 format, and from the 8.3 format to the long format.

LFN_ALT.pas
unit LFN_ALT;
interface
function AlternateToLFN(AltName:String):String;
function LFNToAlternate(LongName:String):String;

implementation

uses Windows;

function AlternateToLFN(AltName:String):String;
var
  temp: TWIN32FindData;
  searchHandle: THandle;
begin
  searchHandle:=FindFirstFile(PChar(AltName),temp) ;
  if searchHandle <> ERROR_INVALID_HANDLE then
    result := String(temp.cFileName)
  else
    result := '';
  Windows.FindClose(searchHandle) ;
end;

function LFNToAlternate(LongName:String):String;
var
  temp: TWIN32FindData;
  searchHandle: THandle;
begin
  searchHandle:=FindFirstFile(PChar(LongName),temp) ;
  if searchHandle <> ERROR_INVALID_HANDLE then
    result := String(temp.cALternateFileName)
  else
    result := '';
  Windows.FindClose(searchHandle) ;
end;
end.{unit}
Trackback 0 Comment 0