21.09.2013, 15:27
I can't understand why i get an error when i try to read a line from file and parse it with sscanf ...
This write in file:
This is file output:
And this is read code:
And i get 'Error loading vehicle' in console. I counted every param to be sure that i didn't miss some but i didn't found the problem
This write in file:
Код:
format(string, sizeof(string), "%d,%d,%s,%d,%f,%f,%f,%f,%d,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", CarInfo[vehid][cType], CarInfo[vehid][Model], CarInfo[vehid][cOwner], CarInfo[vehid][Extra], CarInfo[vehid][Pos][0], CarInfo[vehid][Pos][1], CarInfo[vehid][Pos][2], CarInfo[vehid][Pos][3], CarInfo[vehid][Color][1], CarInfo[vehid][Color][2], CarInfo[vehid][Plate], CarInfo[vehid][Lock], CarInfo[vehid][Interior], CarInfo[vehid][VirtualWorld], CarInfo[vehid][Paintjob], CarInfo[vehid][cComponent0], CarInfo[vehid][cComponent1], CarInfo[vehid][cComponent2], CarInfo[vehid][cComponent3], CarInfo[vehid][cComponent4], CarInfo[vehid][cComponent5], CarInfo[vehid][cComponent6], CarInfo[vehid][cComponent7], CarInfo[vehid][cComponent8], CarInfo[vehid][cComponent9], CarInfo[vehid][cComponent10], CarInfo[vehid][cComponent11], CarInfo[vehid][cComponent12], CarInfo[vehid][cComponent13]);
Код:
1,481,The State,-1,1106.685302,-1432.360595,15.796875,273.642517,0,0,GF-13-RO,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Код:
if(sscanf(string, "dds[25]dffffdds[32]dddddddddddddddddd", CarInfo[vehid][cType], CarInfo[vehid][Model], CarInfo[vehid][cOwner], CarInfo[vehid][Extra], CarInfo[vehid][Pos][0], CarInfo[vehid][Pos][1], CarInfo[vehid][Pos][2], CarInfo[vehid][Pos][3], CarInfo[vehid][Color][1], CarInfo[vehid][Color][2], CarInfo[vehid][Plate], CarInfo[vehid][Lock], CarInfo[vehid][Interior], CarInfo[vehid][VirtualWorld], CarInfo[vehid][Paintjob], CarInfo[vehid][cComponent0], CarInfo[vehid][cComponent1], CarInfo[vehid][cComponent2], CarInfo[vehid][cComponent3], CarInfo[vehid][cComponent4], CarInfo[vehid][cComponent5], CarInfo[vehid][cComponent6], CarInfo[vehid][cComponent7], CarInfo[vehid][cComponent8], CarInfo[vehid][cComponent9], CarInfo[vehid][cComponent10], CarInfo[vehid][cComponent11], CarInfo[vehid][cComponent12], CarInfo[vehid][cComponent13])) printf("Error loading vehicle");