Hi guys I just wanna ask what is the difference between the mode_t and st_mode when using sys/stat.h and sys/types.h libraries. I looked them up google and find most people use st_mode but never mode_t.
number87 0 Junior Poster in Training
Recommended Answers
Jump to PostWell in the context of your follow-on question
http://www.daniweb.com/forums/thread173650.html
the macros like S_IFDIR are meaningless. You're reading a string of characters from the input.So look at the string containing all the modes (that's the "drwxrwxrwx" thing) and make your determinations.
Jump to Post> because if this is the situation, and I implement a strtok or strchr to check the string for d,w,r,x what if the filename is also dwrxdwrx?
Er, because the permissions are always in field 3, and the filename is always in field 7 (or whatever your 'ls' generates)…
All 7 Replies
ArkM 1,090 Postaholic
number87 0 Junior Poster in Training
number87 0 Junior Poster in Training
Salem 5,265 Posting Sage
number87 0 Junior Poster in Training
Salem 5,265 Posting Sage
number87 0 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.