473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to access Folders and its all contents in Windows XP using C

Hi,

This is Sasidhar. I would like to know how can I access Folders and its contents in Windows XP using C. I am using Turbo C++ 3.0 as a compiler. Which header files do i need to use for my problem. What are the topics should i know to work with files and folders. Where can I get a full description on Files and Folders topic for C Programming language? Please help me in this.

Regards,
Sasidhar.
Nov 7 '06 #1
1 1515
horace1
1,510 Expert 1GB
Hi,

This is Sasidhar. I would like to know how can I access Folders and its contents in Windows XP using C. I am using Turbo C++ 3.0 as a compiler. Which header files do i need to use for my problem. What are the topics should i know to work with files and folders. Where can I get a full description on Files and Folders topic for C Programming language? Please help me in this.

Regards,
Sasidhar.
Your question is a bit vauge but I assume you need a program which will read the list of files in a directory. The following program (which works OK using Turbo C) does this and lists the files to the screen
Expand|Select|Wrap|Line Numbers
  1. // list directory, see
  2. //  http://www.opengroup.org/onlinepubs/007908799/xsh/readdir.html
  3.  
  4. #include <stdio.h>
  5. #include <sys/types.h>
  6. #include <dirent.h>
  7. #include <sys/stat.h>
  8. #include <fcntl.h>
  9. int main()
  10. {
  11. DIR *dirp = opendir(".");
  12. int errno=0;
  13. struct dirent * dp;
  14. while (dirp) {
  15.     errno = 0;
  16.     if ((dp = readdir(dirp)) != NULL) {
  17.        printf("file name %s \n",dp->d_name); 
  18.     } else {
  19.         if (errno == 0) {
  20.             closedir(dirp);
  21.             return 0;
  22.         }
  23.         closedir(dirp);
  24.         return -1;
  25.     }
  26. }
  27. }
  28.  
Nov 7 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Angel Mazo | last post by:
Dear all, I have a very weird Access 97 MDE behavior that I don't know how to explain and, of course, how to solve: .. I have a site with 14 PC's, mixed Windows XP Pro and Windows 98, running...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
8
by: James | last post by:
I developed a small data-entry ASP.NET app on my workstation (WinXP Pro). It connects to a SQL Server 2000 DB using integrated security. This is located on a server, SERVER1. SERVER1 is also our...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
5
by: Nosferatum | last post by:
I am in need of a solution on how to solve this problem: I need to limit access to six different folders. My users are validated in a system which check their prescence with a couple of...
4
by: lorirobn | last post by:
Hi, I need to add photos to my database. Back End is on MS SQL Server (I believe 2000), and Front End is on MS Access. I have read about storing the photos as BLOBS, but I am not sure how to...
10
by: Arno R | last post by:
Hi all, So I bought a new laptop 10 days ago to test my apps with Vista. (home premium) Apparently Office 2007 is pre-installed. (a time limited but complete test version, no SP1) So I take the...
2
by: mrz | last post by:
This may be simple, but I'm not trained in networking. Just thrown into the job by default. Our church has a machine running Windows 2003 server and 10 clients running Windows XP. We have a shared...
25
by: p byers | last post by:
Good Morning Folks I have a LAN Among the several connections to it are the following four devices: A MAXSTOR network Storage Device A PC running Microsoft Windows 2000 Server 5.0.2195 (SP4) A...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.