slip5

By: Anonymous5/19/2023105 views Public Note
#include #include #include int main(int argc, char *argv[]) { char substr[20]; int flag=0; DIR *d; struct dirent *dir; d = opendir("."); printf("\n Enter the string that starts with:: "); gets(substr); //if( argc >1) //{ // strcpy(substr,argv[1]); // strcpy(substr,argv[1]); if (d) { while ((dir = readdir(d))!= NULL) { // printf("%s\n", dir->d_name); if(strncmp(substr,dir->d_name,strlen(substr))==0) { printf("\n %s", dir->d_name); } } closedir(d); } // } //else // printf("Insufficient arguments"); }

Want to create your own notes?

Join thousands of users writing securely on ProNotepad.