在任意位置获取argc与argv

首先在程序里声明,

extern char ** *_NSGetArgv(void);
extern CFIndex *_NSGetArgc(void);

然后就可以调用,

    char ** argv = *_NSGetArgv();
    CFIndex count = *_NSGetArgc();
    for (int i = 0; i < count; i++) {
        printf("%sn",argv[i]);
    }
声明: 本文为0xBBC原创, 转载注明出处喵~

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.