#562 closed defect (fixed)
psFitsOpen mode parameter definition
| Reported by: | Owned by: | eugene | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PSLib SDRS | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
In the SDRS, the 'mode' parameter is defined to be either 'r', 'r+', 'rw', or 'w'. There are two distinct
problems with this:
- mode is a const char, not a const char*, i.e., a string. This makes multiple character values like 'r+'
or 'rw' impossible.
- CFITSIO supports only two options: read-only or read-write. The 'w' value, i.e. write-only, is not
possible.
Givent the limitations of CFITSIO, I suggest that the mode parameter be simplified to a boolean value to
indicate if the file is to be writable, e.g.:
psFits* psFitsOpen(const char* filename, bool writable);
-rdd
Change History (3)
comment:1 by , 21 years ago
| Owner: | changed from to |
|---|
comment:2 by , 21 years ago
| Cc: | added |
|---|---|
| Status: | new → assigned |
comment:3 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Gene prefers that we should mimic fopen().
I fixed the missing * in the prototype:
psFits *psFitsOpen(const char *filename, const char *mode);
Note:
See TracTickets
for help on using tickets.

The intent was not only to prevent certain operations from being performed, but
also to specify the behaviour when the file exists:
"r": Opened read-only
"r+" or "rw": Opened read-write.
"w": Empty file created (perhaps like an open followed by a psFitsTruncate?)
I think this is a trinary choice, not binary so that we can't use a single
boolean. We could use two booleans, one to say if the file is writeable, and
one to say if we should open a new file for writing. Perhaps this is more in
keeping with the lack of a write-only ability.
Thoughts?