How do I access program arguments in Swift?

后端 未结 5 796
别跟我提以往
别跟我提以往 2020-12-01 03:11

C and derivatives have argc and argv (and envp) parameters to their entry point functions, but Swift doesn\'t have one proper: top-lev

5条回答
  •  庸人自扰
    2020-12-01 03:24

         import Foundation
    
    
         println(C_ARGC) //CInt    
         println(C_ARGV) // CString
    

    As in the above code, you can use C_ARGC to get number of arguments. C_ARGV to get this arguments.

提交回复
热议问题