I am always very reluctant to posting new topics in forums in case I get in trouble for not following rules or something, but this time I really am confused even after googling! I am very new to the Objective C programming language!
I have written out Kochan's example program 16.7 from the book and Xcode has produced an error on the "[outFile truncateFileAtOffset: 0];" line. In a green little box (while running the code) comes "Thread 1: Signal SIGABRT".
Here is the error description listed in the output box:
2012-08-02 19:55:58.441 prog 16.7[1460:303] *** Terminating app due to uncaught exception 'NSFileHandleOperationException', reason: '*** -[NSConcreteFileHandle truncateFileAtOffset:]: Invalid argument'
*** First throw call stack:
0 CoreFoundation 0x00007fff8e9d6716 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff8fda0470 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8e9d64ec +[NSException raise:format:] + 204
3 prog 16.7 0x0000000100001b4e main + 414
4 prog 16.7 0x00000001000019a4 start + 52
5 ??? 0x0000000000000001 0x0 + 1
libc++abi.dylib: terminate called throwing an exception
I honestly don't understand why this error is showing up. 0 should be a valid argument for truncateFileAtOffset:, right?. Nobody else has mentioned this issue so it clearly must be me being stupid or something. And if I'm not being too cheeky saying this, I have a similar-ish problem in prog 16.8 too (I haven't gone any further in the book)...But I'll wait for a response about the question at hand first...
I have attached the main code to this post just if needed. I am running Xcode 4.4 on Mountain Lion (I have tried this program before upgrading to ML).
I would like to say that this book is absolutely fantastic and it has been very very well written!
Thanks for your time reading this post!