#include <stdio.h>
#include <dirent.h>
#include <string.h>
int main()
{
DIR *dir;
struct dirent *entry;
char stationen[1213][2][50];
const char *path = "/etc";
int i = 0;
dir = opendir(path);
while (entry = readdir(dir))
{
const char *name = entry->d_name;
if (i<1213 && strlen(name) == 10)
{
strcpy(stationen[i][0], name);
sprintf(stationen[i][1],"%.*s",5,name);
i++;
}
}
while(i--)
{
printf("Ermittle Ortsname zu Stations-Nummer %s %s\n", stationen[i][0], stationen[i][1]);
}
return 0;
}