My problem is with what should be a fairly basic procedure, but is causing a huge holdup in my program. I have a vector of strings which holds the names of files to open, these files are all named sequentiulay. The code reads as follows
1 2 3 4 5 6 7 8 9 10 11
|
void getname(){
for (int i=0, j=i+1, k=j+102; i<102;)
{
string is= to_string(i);
name1=is+"_500V_lm.dat";
name2=is+"output.txt";
names[j]=name1;
names[k]=name2;
i++;
}
|
*Note* The variables are all global variables and I am using the name 1, name 2 strings as an attempted fix for the problem
So the problem is that when I try to access the names stored in the names vector, it returns empty, but name1&2, when checked using cout, are fine.
also, before running this sub process, as a way to try to diagnose this problem I checked the vector using
1 2
|
names[1]="name";
cout << "just to check..." <<names[1]<<endl;
|
and it returned fine...
Is it a code error or compiler strangeness?
EDIT*: The program runs fine, it returns zero and goes through the entire program, but it does not create the output files