Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2000-10

Re: LFN->SFN

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

MPDJ

Hi,

I'm using the GetShortName function, yet it returns the long-filename again and not the short-filename as it should do? Is this a bug?

Also, FindClose(searchrec) returns the compiler error (integer expected). It compiles if I put an integer as the parameter but this is incorrect.

I'm using V1.02 Win32 compiler.

Andy

Reply by email

Peter Vreman
to MPDJ
Show quoted text 7 lines
I'm using the GetShortName function, yet it returns the long-filename again and not the short-filename as it should do? Is this a bug? Also, FindClose(searchrec) returns the compiler error (integer expected). It compiles if I put an integer as the parameter but this is incorrect. I'm using V1.02 Win32 compiler.

Use the following order of unit includes:

uses
  windows,dos;

The dos functions will then override the functions declared in the windows unit with the same names

Peter

Reply by email

MPDJ
to Peter Vreman

Many thanks. It fixed the FindClose problem, yet it fails to return the short-filename.

Despite several different methods of writing it, it only returns the long filename again when using the GetShortName function.

I'm betting it's a stupid mistake on my part or something I'm overlooking, though I just can't get it to work.

Andy

Reply by email

Peter Vreman
> Despite several different methods of writing it, it only returns the

lo> ng

> filename again when using the GetShortName function. This GetShortName is a FreePascal library routine, is it not? I only

foun> d a

reference to it in a compiled DOS unit in my installation. The original Win32 API function is called GetShortPathName and it works for me all

rig> ht.

As a general rule, you should use the Win32 functions directly if you

don> 't

need portability or some extended features an additional library would

ad> d.

The getshortname of the dos unit should also work as it contains only a pascal string wrapper around the getshortpathname api call.

Peter

Reply by email