Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Grumpfish Library 3.2 - <b>gsavearray()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
GSAVEARRAY()

    Clipper has no inherent provision for saving arrays to a memory
    variable (.MEM) file.  GSAVEARRAY() does the next best thing:
    it allows you to save an array to a text file.

    Syntax

    GSAVEARRAY(<array>, <filename> [, <lReadonly> ])

    Required Parameters

    <array> is the name of the array to be saved. Obviously, this must
    be declared prior to calling this function.  Do not enclose this in
    quotes!

    <filename> is the name of the file in which to save the array.
    BEWARE: if this file already exists, it will be overwritten!

    Optional Parameter (Clipper 5 only)

    <lReadonly> specifies that the file to be created be read-only.
    Pass a logical true (.T.) for a read-only file.  By default,
    the file will be normal (read/write).

    Return Value

    GSAVEARRAY() returns a logical value: True (.T.) if the save was
    successful; False (.F.) if it was not.  Reasons for it failing would
    be related to an inability to create the file (probably due to lack
    of available file handles) or inability to write to the file (in
    which case mysterious forces may be at work inside your computer).

    Sample Usage

    ** Summer '87                   
    PRIVATE myarray[4]              
    myarray[1] = "Character"        
    myarray[2] = DATE()             
    myarray[3] = 5.25               
    myarray[4] = .f.                
    GSAVEARRAY(myarray, 'array.txt')

    /* Clipper 5.0 - works with nested arrays */         
    local a := { 'one', 'two', 'three', NIL, ;           
               { 'this', 'is a', {'another', 'test'} }, ;
               date(), 5, .t. }                          
    gsavearray(a, 'temp.txt', .t.)    // read-only       

See Also: GLOADARRAY() GFREADLINE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson