[ / / / / / / / / / / / / / ] [ dir / random / cuteboys / cyber / hentai / htg / k / mde / s / wx ]

/g/ - Technology

Make /g/ Great Again
Name
Email
Subject
Comment *
File
Password (Randomized for file and post deletion; you may also set your own.)
Archive
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Voice recorder Show voice recorder

(the Stop button will be clickable 5 seconds after you press Record)
Options
dicesidesmodifier

Allowed file types:jpg, jpeg, gif, png, webm, mp4, swf, pdf
Max filesize is 16 MB.
Max image dimensions are 15000 x 15000.
You may upload 5 per post.


File: 149db237e100fd2⋯.jpg (5.82 KB, 250x250, 1:1, 1532277388439(1).jpg)

 No.8524

How do I read flags as well as multiple arguments? For example, ls. If you provide 2 directories, you get a list of both directories and the flags specified also work. How do I replicate this? I've tried looking at GNU ls, BSD ls, and BusyBox ls but I couldn't make heads or tails of anything.

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.8530

>>8524

>ls

I don't think C standard library has a method for searching directory contents, you need to make calls to the operating system. The method changes depending on what OS you're on, look up the documentation for it.

>how do I read multiple arguments

Did you even try to read a tutorial on C?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.8534

>>8524

Argp is the library you're looking for for parsing command-line arguments. However, if you're at the stage where you didn't know about argc, argv and multiple arguments, its going to be a pain to get your head around.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.8535

>>8534

Oh yeah, try and find a PDF of 'step by step into argp.'

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



[Return][Go to top][Catalog][Nerve Center][Random][Post a Reply]
Delete Post [ ]
[]
[ / / / / / / / / / / / / / ] [ dir / random / cuteboys / cyber / hentai / htg / k / mde / s / wx ]