delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/12/04:21:19

Xref: news2.mv.net comp.os.msdos.djgpp:3724
From: Shawn Hargreaves <slh100 AT york DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: File capture in Allegro
Date: Thu, 9 May 1996 22:31:03 +0100
Organization: The University of York, UK
Lines: 37
Message-ID: <Pine.SGI.3.91.960509105301.8470B-100000@tower.york.ac.uk>
NNTP-Posting-Host: tower.york.ac.uk
Mime-Version: 1.0
In-Reply-To: <4mrlt5$2qc@frodo.smartlink.net>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Thu, 9 May 1996, Nicholas Marrone wrote:

> 	Can someone explain to me how to use the file_select function in
> Allegro? I've read the docs, and looked at one of the examples
> (grabber.c), but I don't understand how to capture the name of the
> file that gets selected. Any help is very appreciated. Thanks!

From allegro.txt:

int file_select(char *message, char *path, char *ext);
   Displays the Allegro file selector, with the message as caption. Allows 
   the user to select a file, and stores the selection in path.

So try something like:

   char path[80] = "";
   if (file_select("Choose a file", path, NULL))
      printf("file: %s\n", path);
   else
      printf("file selector was canceled\n");

The path parameter is used both for input and output: you can use it to 
set the initial path to display and an inital filename (eg. for a 'save 
as' operation where you want to start with the current name displayed), 
and the file selector changes it to whatever file is chosen. I know the 
docs aren't very clear on this, but I'm working on them. Version 2.01 is 
going to have more detailed explanations of things :-)


/*
 *	Shawn Hargreaves.        Why is 'phonetic' spelt with a ph?
 *	Check out Allegro and FED on http://www.york.ac.uk/~slh100/
 */




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019