#File access help
4 messages in this thread
Hello experienced programmers,
I have a program that asks a user to enter a file name to open. As you know,
not having your program list the possible files makes it difficult for a user.
I understand that getting someone to explain all the code for obtaining the
names of, and displaying files to the screen would be much to ask so..
All I request of you is that you give me the names of all the functions I
will have to include in my program to perform the above mentioned task. If I
have all the pieces of the puzzle I will have a better chance of completing it.
I still use the Manx 3.6a compiler. Thank you in advance for your time.
Henry PS: Can anyone (sysop?) tell me which forum and section has the best
info on our Amiga's future?
Try the AmigaUser Forum in the Hot News and Rumors, Ramblings, and Soapbox
sections.
1. I'm sure you know this part, but since the Amiga is multitasking, you can
always open another CLI/Shell and take whatever directory listing you need to
get a file name. Heck, with 2.0 and beyond, you can cut-and-paste the name of
the file you want over to the application. I note this largely because poor
MSDOS-brainwashed souls often don't realize that they have this option.
2. A directory itself comes from DOS, although DOS won't give you the pretty
windowing/selection options that I'll mention in a moment. What you use
depends on your target operating system: if you want to work in pre-2.0
systems, you should use Examine(lock,*FileInfoBlock), followed by
ExNext(lock,*FileInfoBlock). If you'll be working with 2.0-and-after systems
only, ExAll(lock,*buffer,size,type,*control) is considered better.
3. You want the whole scheme, including requestors? For pre-2.0, the ARP
library was a godsend. req.library and reqtools.library also handled the job
in a more sharply focused manner, and the latter (at least) is still used on
current operating systems. With 2.0 systems and beyond, Commodore has provided
a standard asl.library, where you would use RequestFile(*FileRequester); the
FileRequester is obtained with a call to AllocFileRequest() and released with
FreeFileRequest(*FileRequester).
Those are the current techniques I know of. Others may add to the above, or
suggest their preferred approach. (Or correct any blunders I might have made).
–Jim
I haven't tried this myself, but according to the autodocs the functions you
need for the ASL file requester are :
AllocAslRequest () – This puts up the requester AslRequest () – This
requests the file FreeAslReuest () – This gets rid of the requester
Peter Wade
Autopiloting from London, England