[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54102] Origin specifier in fseek
From: |
Michael Leitner |
Subject: |
[Octave-bug-tracker] [bug #54102] Origin specifier in fseek |
Date: |
Tue, 12 Jun 2018 03:27:29 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 |
URL:
<http://savannah.gnu.org/bugs/?54102>
Summary: Origin specifier in fseek
Project: GNU Octave
Submitted by: mleitner
Submitted on: Tue 12 Jun 2018 07:27:27 AM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Documentation
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.0
Operating System: GNU/Linux
_______________________________________________________
Details:
Try
fid=fopen("bla","w");
fseek(fid,0,"bof")
fseek(fid,0,'SEEK_SET')
fseek(fid,0,0)
fclose(fid);
Apparently at some point the C-inspired way of specifying fseek origin has
been dropped to follow Matlab and allow "cof"/0, "bof"/-1 and "eof"/1.
However, this is not reflected in the documentation, which still speaks of
'SEEK_SET'/"cof" and analogues. I think that it would not hurt to relax with
respect to Matlab and allow all three possibilities.
Further, is it really the best option to refuse any fseeks beyond the
end-of-file? This is more or less the standard way in C to cheaply allocate
large files. Yes, it seems that Matlab refuses, but this is not even
documented as I see it. You could also do it and just throw a warning in this
case. Or is there another good way to generate large files? Obviously an
fwrite of zeros is suboptimal.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54102>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54102] Origin specifier in fseek,
Michael Leitner <=