Thanks for the post @gfontenot. I’m still reading over it to grock it. I was wondering if there was any advantage to this over using Process.arguments
to get the arguments instead.
Do you mean NSProcessInfo
? I’m using C_ARGV
as a bit of an artificial restriction on myself because I want to see how far I can get without importing Foundation
.
No, just Process.arguments
. Looks like you can also do NSProcessInfo.processInfo().arguments
but that does need Foundation. Process
doesn’t. Here’s the entire contents of my main.swift file for playing around:
println(Process.arguments)
println(Process.arguments.count)
Obviously this doesn’t make for a good blog post or help anyone understand Sequences.
Oh, wow. Didn’t know about Process
. That’s neat. There is far too little documentation right now. Thanks!
In fact, Process
doesn’t even show up in the generated header. How did you find out about that?
Dave DeLong replied to me on StackOverflow: How to I access argv and argc in swift? - Stack Overflow
Ha. So apparently he’s the only one that knows about that Struct. He pinged us on Twitter about it too.