Hi, I have written the following code to add data to text files which are
required to store 3D scan data (I have to calculate the y-coordinate). My
code seems to work except that it stops working when I want to create more than
ten text files i.e. the directory I am trying to store them in will not hold any more than ten text files. Any ideas why this might be happening? Code is shown below. Thanks.
// Prompt user for necessary scan information
cout << "Enter Feed Speed: ";
cin >> fs;
cout << "Enter No. of Profiles/s: ";
cin >> prs;
cout << "Enter Total No. of Profiles: ";
cin >> tpr;
cout << "Provide name of directory: ";
cin >> dir;
// Calculates increment in y-direction
inc = fs / (float)prs;
// Initialise y coordinate to -ve increment
double y = -inc;
for (int i = 0; i < tpr; i++)
{
// y co-ordinate increments
y += inc;
// increment file number (j)
j += 1;
// increment input file number (k)
// Converts coordinate to a string for insertion to *.txt file
stringstream converty, convertj;
converty << y;
convertj << j;
// Creates output file stream object called "outFile" and prompts user to provide a name
// Changes output filename with each successive increment of j
s = convertj.str();
char oname[] = "profile_00x.txt";
oname[10] = s[0];
file = dir + "/" + oname;