Skip to main content
guest
Join | Help | Sign In
Liberty BASIC Programmer's Encyc Home
guest| Join | Help | Sign In
Liberty BASIC Programmer's Encyc
  • Wiki Home
  • Recent Changes
  • Pages and Files
  • Members

Home

General Tutorials
Advanced Tutorials
GUI Programming
Graphics and Games
Strings and Text
Numbers and Math
Using Files
Windows API
Communications
Programmer's Tools

Articles by Date
FAQs
Rosetta Code
General Articles
Newsletters Contents

Table of Contents
Demos

Submit Articles
TOS and License

GetShortPathNameA

Edit 2 …
  • 2 Tags
    • api
    • file
  • Notify
  • RSS
  • Backlinks
  • Source
  • Print
  • Export (PDF)
Older Version Newer Version

Alyce Alyce Dec 29, 2011

GetShortPathNameA

- Alyce Alyce
GetShortPathNameA | DOS 8.3 Filenames | Demo

DOS 8.3 Filenames

In DOS operating systems, filenames were limited to 8 characters and extensions were limited to 3 characters. Some API functions require filenames in this format. A long filename can be converted to a short filename with GetShortPathNameA

To learn more about 8.3 filenames:
8.3 Filenames at Wikipedia

Demo

 filedialog "Open","*.*",file$ 
if file$="" then end

'use function with null short name argument
'first to determine size of buffer needed
calldll #kernel32, "GetShortPathNameA",_
file$ as ptr,_ 'long filename
_NULL as long,_ 'short filename argument, null to get length of buffer
0 as long,_ 'length of buffer, null to get length of buffer
length as ulong 'required length of buffer

'create a string buffer of the correct length:
shortfile$=space$(length)+chr$(0)

calldll #kernel32, "GetShortPathNameA",_
file$ as ptr,_ 'long filename
shortfile$ as ptr,_ 'short filename
length as long,_ 'length of buffer
result as ulong

print "Long filename is "; file$
print "Length of buffer for short filename is ";length
print "Short filename is ";shortfile$

GetShortPathNameA | DOS 8.3 Filenames | Demo
Help · About · Pricing · Privacy · Terms · Support · Upgrade
Contributions to https://lbpe.wikispaces.com/ are licensed under a Custom License.
Portions not contributed by visitors are Copyright 2018 Tangient LLC
TES: The largest network of teachers in the world
Turn off "Getting Started"
  1. Home
  2. ...
Loading...