An working example,
let fm = NSFileManager.defaultManager()
var mh = mach_header() // Defined as C struct,
var lc = load_command() // Defined as C struct
var location = 0
if let data = fm.contentsAtPath("home/user/projects/some.o") {
data.getBytes(&mh, length: sizeof(mach_hea
> On May 19, 2016, at 10:00 AM, Ken Burgett via swift-users
> wrote:
>
> I would like to know if a struct in Swift has any guarantee of contiguity,
> like a struct in C. I am attempting to port a C program that makes many
> assumptions about the underlying semantics of C structs, and does th
I would like to know if a struct in Swift has any guarantee of
contiguity, like a struct in C. I am attempting to port a C program
that makes many assumptions about the underlying semantics of C structs,
and does things like overlaying an array over the struct using a cast,
and then performs a
> On May 19, 2016, at 12:58 AM, Quinn The Eskimo! via swift-users
> wrote:
>
> The reason I ask is that most of the time when I mess around with files I
> transfer the entire file to and from memory, which is something that the
> Foundation APIs excel at.
I believe Mac/iOS developers usually
> On 18 May 2016, at 11:56, Artyom Goncharov via swift-users
> wrote:
>
> Hi, here is the playground snippet:
>
> var noOptDict = ["one": 1, "two": 2, "three": 3 ]
> noOptDict["one"] = nil
> noOptDict // “one” is gone
>
> var optDict: [String: Int?] = ["one": 1, "two": 2, "three": nil]
> optD
On 18 May 2016, at 23:02, John Myers via swift-users
wrote:
> I've been having trouble figuring out how to read and write data to a
> textfile …
Your examples show you transferring the data line-by-line. Is that the end
goal? Or just fallout from what you happened to get working?
The reas