HI,
I can't find how to read my data file in swift (converting from Objective-C). The file consists a mixture of bytes, UInt16, UInt32, SInts16 ,strings (as pascal strings), png and mp3 data all mixed up as I use a 'byte' to indicate what sort of data is next.
I tried:-
var data = (NSData)();fileHandle?.readData(ofLength: MemoryLayout.size(ofValue: UInt8()))
But can't use "getBytes etc" so can't get the value.
I thought this would work for UInt16s but no-go
var num = UInt16(); fileHandle?.readData(ofLength: MemoryLayout.size(ofValue: UInt16()))
I'm about to give up and stay with Objective-C.
Any help appreciated.
Paul
I can't find how to read my data file in swift (converting from Objective-C). The file consists a mixture of bytes, UInt16, UInt32, SInts16 ,strings (as pascal strings), png and mp3 data all mixed up as I use a 'byte' to indicate what sort of data is next.
I tried:-
var data = (NSData)();fileHandle?.readData(ofLength: MemoryLayout.size(ofValue: UInt8()))
But can't use "getBytes etc" so can't get the value.
I thought this would work for UInt16s but no-go
var num = UInt16(); fileHandle?.readData(ofLength: MemoryLayout.size(ofValue: UInt16()))
I'm about to give up and stay with Objective-C.
Any help appreciated.
Paul