home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / programm / 19974 < prev    next >
Encoding:
Internet Message Format  |  1992-12-17  |  1.4 KB

  1. Path: sparky!uunet!noc.near.net!nic.umass.edu!dime!alice.cs.umass.edu!cook
  2. From: cook@cs.umass.edu (Robert Cook)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Possible Bug with fseek in MPW C 3.2.4?
  5. Message-ID: <57670@dime.cs.umass.edu>
  6. Date: 17 Dec 92 15:38:55 GMT
  7. Sender: news@dime.cs.umass.edu
  8. Organization: University of Massachusetts
  9. Lines: 31
  10. X-UserAgent: Nuntius v1.1.1d12
  11. X-XXMessage-ID: <A756093D9A0128C5@alice.cs.umass.edu>
  12. X-XXDate: Thu, 17 Dec 92 15:38:53 GMT
  13.  
  14. I'm trying to increase the size of a file using the function fseek with
  15. no luck,
  16. i.e.
  17.            err=fseek(fp,offset,SEEK_END);
  18. the fseek statement returns back an error, -1.
  19.  
  20. According to the book "C - A Reference Manual" third edition, by Samuel
  21. P. Harbison and
  22. Guy L. Steele Jr. this is possible, and I quote from pg 305, "If
  23. wherefrom is SEEK_END
  24. and offset is positive, then the file is extended the indicated amount
  25. from it end with
  26. unspecified contents."
  27.  
  28. The MPW 3.0 C Reference Manual also eludes to this fact by stating on pg
  29. 122, "If whence
  30. is SEEK_END, the new position is the size of the file plus offset."  But
  31. on pg 123 it states
  32. under "Return values", "An example of an improper seek is an fseek before
  33. the beginning of,
  34. or past the end of, the file."
  35.  
  36. So what gives,  can I use fseek to increase the size of a file?
  37. If so, does this mean MPW C 3.2.4 has a bug in it?
  38.  
  39. Thanks,
  40.  
  41. Bob Cook
  42. Computer Science Department
  43. University of Massachusetts
  44. Amherst, MA 01003
  45.