octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54102] Origin specifier in fseek


From: Rik
Subject: [Octave-bug-tracker] [bug #54102] Origin specifier in fseek
Date: Tue, 12 Jun 2018 11:06:04 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Update of bug #54102 (project octave):

                Category:         Octave Function => Documentation          
                  Status:                    None => Fixed                  
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

The functionality hasn't been removed.  The numerical constant to pass to
fseek is returned by the function SEEK_SET.  Instead of


fseek(fid,0,'SEEK_SET')


you should call


fseek(fid,0, SEEK_SET)


Using 'help SEEK_SET' I get


'SEEK_SET' is a built-in function from the file libinterp/corefcn/file-io.cc

 -- SEEK_SET ()
     Return the numerical value to pass to 'fseek' to position the file
     pointer relative to the beginning of the file.

     See also: SEEK_CUR, SEEK_END, fseek.


I can see how it is a little bit confusing because the @code macro for Texinfo
is putting single quotes around its argument.  The help text for fseek is


octave:1> help fseek
'fseek' is a built-in function from the file libinterp/corefcn/file-io.cc

 -- fseek (FID, OFFSET)
 -- fseek (FID, OFFSET, ORIGIN)
 -- STATUS = fseek (...)
     Set the file pointer to the location OFFSET within the file FID.

     The pointer is positioned OFFSET characters from the ORIGIN, which
     may be one of the predefined variables 'SEEK_SET' (beginning),
     'SEEK_CUR' (current position), or 'SEEK_END' (end of file) or
     strings "bof", "cof", or "eof".  If ORIGIN is omitted, 'SEEK_SET'
     is assumed.  OFFSET may be positive, negative, or zero but not all
     combinations of ORIGIN and OFFSET can be realized.

     'fseek' returns 0 on success and -1 on error.


Even though the text refers to them as variables, it places them in single
quotes.  I changed the Texinfo source so that the displayed help is now



octave:1> help fseek
'fseek' is a built-in function from the file libinterp/corefcn/file-io.cc

 -- fseek (FID, OFFSET)
 -- fseek (FID, OFFSET, ORIGIN)
 -- STATUS = fseek (...)
     Set the file pointer to the location OFFSET within the file FID.

     The pointer is positioned OFFSET characters from the ORIGIN, which
     may be one of the predefined variables SEEK_SET (beginning),
     SEEK_CUR (current position), or SEEK_END (end of file) or strings
     "bof", "cof", or "eof".  If ORIGIN is omitted, SEEK_SET is assumed.
     OFFSET may be positive, negative, or zero but not all combinations
     of ORIGIN and OFFSET can be realized.

     'fseek' returns 0 on success and -1 on error.


The change was made on the stable branch
(http://hg.savannah.gnu.org/hgweb/octave/rev/41ea5f665659) and will be part of
the next bug fix release.



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54102>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]