1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

fileopen

Discussion in 'Support' started by Rex Clark, Sep 5, 2008.

  1. Rex Clark

    Joined:
    May 30, 2008
    Messages:
    57
    Likes Received:
    0
    4NT V8

    fileopen[file,w,b]

    "w"rite appears to make no difference if file exists but seems to behave as tho
    "a"ppend is in affect
    I would expect the file empty with "w"rite parameter

    example from help file altered to show above.

    do r=14 to 8 by -1
    set h=%@fileopen[myfile.txt,write,b]
    echo writing %@filewriteb[%h,%r,this is a test] bytes
    echo closing handle #%h: %@fileclose[%h]
    enddo
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Rex Clark wrote:
    | 4NT V8
    |
    | fileopen[file,w,b]
    |
    | "w"rite appears to make no difference if file exists but seems to
    | behave as tho "a"ppend is in affect
    | I would expect the file empty with "w"rite parameter

    The @fileopen[] function does not behave the same way as the standard C
    library function fopen() for files that already exist. It simply opens the
    file for overwriting. Since 4NT/TCMD version 6 the @TRUNCATE function has
    been made available to shorten the file.
    --
    HTH, Steve
     

Share This Page