Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
FILE_Access
//gcc 5.4.0 #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <string.h> unsigned char val; FILE *file_ptr=NULL, *fp_path=NULL; char fpath[100]="C:\\Users\\stodorov\\Downloads\\Notes\\"; char filenames[500][30]; char path_bool[]="0,0,0"; //-------------------- Reading the filenames --------------- void getfilenames() { DIR *dir; struct dirent *ent unsigned int i; if ((dir = opendir ("C:\\Users\\stodorov\\Downloads\\Notes\\")) != NULL) { i=0; memset(filenames,'\0',sizeof(filenames)); while((ent = readdir (dir)) != NULL) { puts (ent->d_name); strcpy(filenames[i++],ent->d_name); } (void) closedir (dp); //strcpy(filenames[i],not_founded); } else perror ("Couldn't open the directory"); } //------------------------ Path Set ------------------------ void path_set() { printf("The default path is : %s\n\n\r",fpath); /*printf("Y/N?"); //while(path_bool[0]==0) scanf("%s",&path_bool); if(path_bool[0]=='N') { printf("Enter path:"); scanf("%s",fpath); } printf("The set path is : %s\n\n\r",fpath); */ } //-------------------------- MAIN ------------------------- int main(void) { path_set(); getfilenames(); return 0; } //========================================================== DIR *dir; struct dirent *ent; if ((dir = opendir ("c:\\src\\")) != NULL) { /* print all the files and directories within directory */ while ((ent = readdir (dir)) != NULL) { printf ("%s\n", ent->d_name); } closedir (dir); } else { /* could not open directory */ perror (""); return EXIT_FAILURE; }
run
|
edit
|
history
|
help
0
Rudra
program
Finding the second largets value v0.5
Sirali_mi_fonksyonu
Spring 2017 Project 2 v.04
2.1.1 Prime numbers in different threads with thread ID
18BCE2182 MIDTERM QUES-2
20171127_ARRAY_PRIMOS
child process
Sheldon 9 area none aliens as aliens and farms Lockheed Kelly and lame lead district 9