[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Anyone familiar with opendir in c?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 11
Thread images: 2

File: oldphotos3331398433789.jpg (1MB, 1000x642px) Image search: [Google]
oldphotos3331398433789.jpg
1MB, 1000x642px
I'm doing an assignment for a class where I have to make a simplified bash shell in c and opendir is fucking me over right now, though i'm 99% sure i'm using it correctly.
>>
We are not going to do homework for you kid
>>
>>59651369
man 3 opendir
>>
File: Screenshot_2017-03-29_03-49-50.png (183KB, 1366x741px) Image search: [Google]
Screenshot_2017-03-29_03-49-50.png
183KB, 1366x741px
>>59651369
>>
>>59651752
how did I know i'd get this one, yeah I've read the fuckin man pages dude
>>
>>59651740
never asked you to
>>
>>59651369
>opendir is fucking me over right now
How so?
>>
>>59652521
ight, thanks for at least hearing me out. so I'm onto running executables from my shell but we aren't aloud to use execvp since they want us to search the PATH ourselves if the arg passed doesn't have a "/" in it. So I get the PATH usint getenv("PATH") and parse it using ":" as a delim, then put each path into an array. but when I call open dir on the first one which is for example "/home/student/bin" it just returns null and actually corrupts my whole array. I used gdb to witness this firsthand, and idk why it won't work
>>
Sorry dude, can't help ya there, best of luck tho
>>
>>59652560
You fucked up elsewhere, run your program through valgrind.
>>
>>59652560
Why use opendir at all? Just loop through PATH. build your path/file, try to execve it. If it fails check errno, if it's ENOENT try the next one.
Thread posts: 11
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.