Hi everyone, I have my program that loops through a chosen directory listing all of the files in it with the file path . However I would like to pass the string containing each file path to a new fiunction in my program so I can use that string to do processing on the file.
Can anyone help me on how to pass the variable, I know its a simple question but im a bi of a beginner
Code:int main(void) { DIR *d; struct dirent *dir; cout << "Enter the name OF FOLDER: "; string g_1; getline( cin, g_1 ); d = opendir ( g_1.c_str() ); if (d) { while ((dir = readdir(d)) != NULL) { string filepath; string g = dir->d_name; string filename1 = g_1 + g; cout << filename1<<endl; } closedir(d); } return(0); } void processFile(ifsteam& file) { //I WOULD LIKE TO PASS MY STRING 'filename1' TO THIS FUNCTION }
thank you