Hi
I used an variable int i; in a faunction block as it is in a code below.
#includes....
int i;
int function()
{
while(charbuff[i]!=' ')
{
ofstream stream("file.lng", ios::app)
stream << charbuff[i];
i++;
stream.close();
}
return 0;
}
main()
{
........... some code
function(); /*call function */
cout << i; /* the i is set to 0*/
........... some code
}
I declared the variable as a global variable (??) I think.
It is declared out of all functions right after the #include lines.
The problem is> I need to have the int i as it is, after it is leaving the above function (for example 5). I want to test the same character from charbuff array in other function.
It always reset it to int i=0.
Why the i does not stay the same as the function done its job.
thanks for help