file to memory

From: Marc Hawley <Marc_Hawley_at_email.msn.com>
Date: Wed, 27 Oct 1999 21:06:39 -0500

Jerry:

The scramble you got was a file attachment. Here is the same file as
inserted text:

....Marc Hawley

\ open file dialog based on life.f

create dbuffer 1000 /allot

create zfilters
 ,z" Worksheets (*.wks)" ,z" *.wks"
 ,z" Text files (*.txt)" ,z" *.txt"
 ,z" All files (*.*)" ,z" *.*"
 0 ,

create zext ,z" ext" 0 ,

create zdir ,z" C:\SwiftForth" 0 ,

0 OFN_OVERWRITEPROMPT OR CONSTANT zflags

 create zname 256 /allot \ for path and filename
    \ needs zeros

: /z-ofn ( a -- )
 19 cells !+
 HWND !+
 HINST !+
 zfilters !+
 NULL !+
 NULL !+
 1 !+ \ index
 zname !+
 256 !+ \ max file name
 NULL !+ \ file, no path
 NULL !+ \ max
 zdir !+ \ init dir string
 NULL !+ \ title of dialog
 zflags !+ \ flags
 NULL !+ \ offset + extention
 zext !+
 NULL !+
 NULL !+
 NULL !+
 drop ;

: z-open
 19 CELLS R-ALLOC
 dup /z-ofn
 GetOpenFileName drop
 ;

: z-save
 19 CELLS R-ALLOC
 dup /z-ofn
 GetSaveFileName drop
 ;

: z-get
 z-open
 zname zcount \ addr len
 R/W \ read write access method
 OPEN-FILE \ ID 0 --
 0= if \ ID
>r \ -- ID --
 dbuffer 1000 r> \ addr len id --
 read-file 2drop \ --
 else drop
 then
 ;

/ eof

.
Received on Wed Oct 27 1999 - 21:06:39 PDT


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.