Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Significantly revised from 8.2. 8.2 version

## save-file

Arguments: text-edit-pane file

Saves the current text of a `text-edit-pane` to a file. text-edit-pane should be a `text-edit-pane` (for a `rich-edit-pane`, use rich-edit-save instead).

file should be a pathname or path namestring indicating where to save the file. If a file already exists at this location, it is replaced by the newly-saved file. (The existing file is backed up temporarily during the save, and if an error occurs then the original file is restored when the error is unwound).

On the Windows platform, the file typically will be written using the character encoding that load-file deemed the file to have, if load-file has been called on the `text-edit-pane`. See external-format-for-saved-files for more information.

On the GTk platforms, the file will be always be written with a UTF8 character encoding, which GTk generally always uses (as does Allegro by default on *nix platforms).

Compatibility note: In earlier releases, this function would invoke the file dialog if a file argument (which was optional) was not supplied. This is no longer done, primarily because there was no way to specify the various options of the file dialog (unless we copied all the paramaters of ask-user-for-new-pathname to save-file, which would be poor design). If an application wishes to call save-file with a user-specified file, it should now first call ask-user-for-new-pathname if needed, and then pass the returned file to save-file (unless `nil` was returned due to the user canceling the dialog). save-file used to (but no longer does) accept an allowed-types keyword argument (although this was not documented). If an allowed-types argument is desired, then it should be passed to ask-user-for-new-pathname instead.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page has had significant revisions compared to the 8.2 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Significantly revised from 8.2. 8.2 version