I want to read files and folder names from directories.
I have used the following code.
But the problem is that in the output the file name gets truncated.(See the output below)
#include <dirent.h>
#include <stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
DIR *d;
struct dirent *dir;
d = opendir(".");
if (d)
{
while ((dir = readdir(d)) != NULL)
{
printf("%s\n", dir->d_name);
}
closedir(d);
}
getch();
}
=====
OUTPUT
=====
ABCABC~1.CPP
CURREN~1.EXE
CURREN~1.OBJ
============
The actual naes of the files are:
abcabcd.cpp
currentfolder.exe
currentfolder.obj
I would like to read the files as their original names....but I am unable to do so..
Please help!!