V
vj
I am using Borland C++.
I run a program which generates output data files, say 'Voltage.dat',
'Current.dat'. I have a variable in my code (say N), and for various
values of N (for each value of N), I generate these output data files.
After running the program once for a given value of N (say N equal to
1) and when the programme is finished, I manually append the generated
filename with the value of N, such as 'Voltage_N1.dat',
'Current_N1.dat'. Then I go back to the code, make N=2, repeat the
procedure and append the generated output files with '_N2' etc.
Is there a simple way of appending the filenames automatically? In
other words, I want to run the programme in a loop for various values
of N (I know this bit i.e. how to make a loop, and for each run, the
files generated (such as 'Voltage_N ') is appended by the value of N
i.e. 1, 2 and so on, followed by the extension '.dat'.
I know after reading the help file that there are functions like
strcpy and strcat, but couldn't figure out how to use them and their
exact format. Also, I am not conversant with Classes, pointers in C++.
(An easy to understand and basic reply with steps will be highly
appreciated).
Thankyou
I run a program which generates output data files, say 'Voltage.dat',
'Current.dat'. I have a variable in my code (say N), and for various
values of N (for each value of N), I generate these output data files.
After running the program once for a given value of N (say N equal to
1) and when the programme is finished, I manually append the generated
filename with the value of N, such as 'Voltage_N1.dat',
'Current_N1.dat'. Then I go back to the code, make N=2, repeat the
procedure and append the generated output files with '_N2' etc.
Is there a simple way of appending the filenames automatically? In
other words, I want to run the programme in a loop for various values
of N (I know this bit i.e. how to make a loop, and for each run, the
files generated (such as 'Voltage_N ') is appended by the value of N
i.e. 1, 2 and so on, followed by the extension '.dat'.
I know after reading the help file that there are functions like
strcpy and strcat, but couldn't figure out how to use them and their
exact format. Also, I am not conversant with Classes, pointers in C++.
(An easy to understand and basic reply with steps will be highly
appreciated).
Thankyou