hey all !!
I was trying to write a save/load function in form of a .txt file (coordinates of objects would save themself in a form of a file.)
save function is working well and for that i use fprinf() function, but when i try to use fscanf to read from a file it doesnt work ....all wariables i read are 0 and when i try to use brak point to debug my program when i get to fscanf function it says "There is no source code available for the current location." and it want me to browse for a file named "fscanf.c" if i try to breakpoint at the load function it is the same for the fprintf but that function works just fine .....
i hope someone can help me ...
cheers, Compufreek
//save smtn
if ( dbKeyState(28))
{
for (int i = 1;i<=maxobjects;i++)
{
fprintf(datoteka,"%f\n%f\n%f\n%f\n%f\n%f\n",dbObjectPositionX(i),dbObjectPositionY(i),dbObjectPositionZ(i),dbObjectAngleX(i),dbObjectAngleY(i),dbObjectAngleZ(i));
}
rewind (datoteka);
}
//load smtn
if ( dbKeyState(14))
{
float pisalo = 0;
int save_obj = selectedobj;
selectedobj = 1;
for (int j=1;j<=maxobjects;j++)
{
for (int i =0;i<6;i++)
{
fscanf(datoteka,"%f",&pisalo);
polje[i] = pisalo;
}
posx = polje[0];
posy = polje[1];
posz = polje[2];
rotationx = polje[3];
rotationy = polje[4];
rotationz = polje[5];
dbRotateObject(selectedobj,rotationx,rotationy,rotationz);
}
fprintf(datoteka1,"%f\n%f\n%f\n%f\n%f\n%f",polje[0],polje[1],polje[2],polje[3],polje[4],polje[5]);
rewind(datoteka1);
selectedobj = save_obj;
}