Recursive directory creationTrackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
And how does "mkdir -p" implement it?
bong
Its a C program not a shell script, so no mkdir -p. And I will not use system, exec, ... for such things
did you really test your code?
char *p; ... p = '/'; -> segfault you could also check opath[0] for a '/' so it won't try to access and create an empty path.
Yes off course I do.
The code seems to be fucked up because of the html formatting. Fuck, thanks! See http://nion.modprobe.de/tmp/mkdir.c for the difference.. It works! Fucking blog editor.
hi,
why don't you use strdup? why don't you use strsep + chdir? best regards
Thanks. I made a few edits to make it work in MSoft Visual C, and made it support wchar_t, and both forward and back slash:
void CreateDirectoryAnyDepth(const wchar_t *path) { wchar_t opath[MAX_PATH]; wchar_t *p; size_t len; wcsncpy_s(opath, path, sizeof(opath)); len = wcslen(opath); if(opath[len - 1] == L'/') opath[len - 1] = L'\0'; for(p = opath; *p; p++) { if(*p == L'/' || *p == L'\\') { *p = L'\0'; if(_waccess(opath, 0)) _wmkdir(opath); *p = L'\\'; } } if(_waccess(opath, 0)) _wmkdir(opath); } Add Comment
|
Calendar
QuicksearchSupportRecent EntriesWill my Phone Show An Unencrypted Connection?
Wednesday, September 8 2010 smpCTF 2010 quals writeups Sunday, August 8 2010 protocol design fail: MMS notification Wednesday, July 28 2010 acrobat reader stealing my passwords Tuesday, June 29 2010 UnrealIRCd backdoored Saturday, June 12 2010 fail of the day: opera Wednesday, June 9 2010 fail2ban + dns = fail Wednesday, May 26 2010 evolution of spam or WTF is this! Friday, March 19 2010 if you type google into google... Wednesday, March 17 2010 Two weeks with the n900 Monday, February 8 2010 ArchivesCategoriesTag cloud23c3 acpi advertising annouce announce april argh art awards bash blogging browser bugs cli code config configuration copyright data mining debconf debian dns documentation email errm? events fail fail2ban filesharing films flame fun gcc google graphs grml hacking hacks hardware heise images information installation internet irc knowledge libacpi links linux mail monitoring network networking news newsbeuter nonsense openoffice open source opera passwords php phrack piratebay power privacy programming qa random blurb rant release releases rss scripts security service setup shell software spam ssh stuff terminal tests text mode tip tips tools troubleshooting unix user video vim.editing web websites wikipedia wordpress wtf www youtube zsh
|
|||||||||||||||||||||||||||||||||||||||||||||||||