Horje
Recursive version of LS in c programming Code Example
Recursive version of LS in c programming
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>

void listdir(const char *name, int indent)
{
    DIR *dir;
    struct dirent *entry;

    if (!(dir = opendir(name)))
        return;

    while ((entry = readdir(dir)) != NULL) {
        if (entry->d_type == DT_DIR) {
            char path[1024];
            if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
                continue;
            snprintf(path, sizeof(path), "%s/%s", name, entry->d_name);
            printf("%*s[%s]\n", indent, "", entry->d_name);
            listdir(path, indent + 2);
        } else {
            printf("%*s- %s\n", indent, "", entry->d_name);
        }
    }
    closedir(dir);
}

int main(void) {
    listdir(".", 0);
    return 0;
}




Whatever

Related
elmah mvc Code Example elmah mvc Code Example
align items in li Code Example align items in li Code Example
private binarynode xxx(binarynode t) { if (t! = = null) while (t.right!=null) t=t.right; return t; } Code Example private binarynode xxx(binarynode t) { if (t! = = null) while (t.right!=null) t=t.right; return t; } Code Example
getIdfrommodelOnClickAjax Code Example getIdfrommodelOnClickAjax Code Example
AZATOR Bot Code Example AZATOR Bot Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8