Hello guYz plz help me out in making it possible to open the files by the adress provided in an array of strings.........
a way to open file is as given below... ifstream infile; infile.open("d:\aslam.txt");
but how can i open file providing an array of string as an adress of file.....
like this infile.open(arr[i]); (but its not working) plz help me.........
From stackoverflow
-
If you are asking about this:
string a[10]; a[0] = "somefile.txt"; infile.open( a[0] );then it won't work because the open() function is expecting a const char * - you want:
infile.open( a[0].c_str() );Note that this is nothing particularly to do with arrays.
: ThankS for YouR replies
0 comments:
Post a Comment