Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- `getopt` example with defaults of `-s 524288*4` and `-b 128*2`.
- */
- #include <getopt.h>
- int main(int argc, char ** argv)
- {
- int memory_size = 524288*4;
- int block_size = 128*2;
- int opt;
- while ((opt = getopt(argc, argv, "b:s:")) != -1)
- {
- switch (opt)
- {
- case 'b':
- block_size = atoi(optarg);
- break;
- case 's':
- memory_size = atoi(optarg);
- break;
- default:
- block_size = 128;
- memory_size = 524288;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement