•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 426,493 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,309 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 380 | Replies: 6 | Solved
•
•
Join Date: May 2008
Location: Mumbai, India
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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)
=====
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!!
I have used the following code.
But the problem is that in the output the file name gets truncated.(See the output below)
C++ Syntax (Toggle Plain Text)
#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!!
Last edited by harsh2327 : May 10th, 2008 at 4:11 am.
•
•
•
•
•
•
•
•
DaniWeb C Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- project plz who can help me (C++)
- Open In New Window Php (PHP)
- Setting an array and reading in a txt file backwards (C++)
- who can help me in c++ project (C++)
- need help with a project (Shell Scripting)
- Virus Of Death - Help Needed! (Viruses, Spyware and other Nasties)
- only a couple of hours to go... (C++)
- I've got Trojan.Holax... is this bad? (Viruses, Spyware and other Nasties)
- not-a-virusadware (Viruses, Spyware and other Nasties)
Other Threads in the C Forum
- Previous Thread: Timing in C addon
- Next Thread: Validating Algorithms



Threaded Mode