From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro 2.2 file_select example Date: Tue, 1 Apr 1997 19:47:56 +0100 Organization: None Distribution: world Message-ID: <9LK8FBAchVQzEwDk@talula.demon.co.uk> References: <859521065 DOT 34821 AT smyrno DOT sol DOT net> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 31 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Kenton E. Sinner writes: >Could someone please post or email me a sample of code for using the >file_select function in an actual program? I've tried, but my programs >keep spontaneously exiting and trying to land in drive A: of all places. Look in allegro/tools/grabber.c. For example, there is a function: /* handle the load command */ int loader() { char buf[256]; strcpy(buf, data_file); *get_filename(buf) = 0; if (file_select("Load data file", buf, "DAT")) { strlwr(buf); load(buf); } return D_REDRAW; } That should be fairly easy to follow. It copies the current filename (data_file) into a temporary string, strips off the filename and extension to leave just the path, displays the file selector, and then calls the load() routine if the user clicked on OK. -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.