C question - Overwriting

Soldato
Joined
22 Oct 2005
Posts
2,884
Location
Moving...
I've got two globally declared strings:
Code:
char locations[5][25];
char speedString[25];
I set the locations string first by filling it with data from a txt file using: (temp being a local string declared like char temp[25])
Code:
locations[count][end] = temp[end];

I then set the speedSting using
Code:
sprintf (speedString, "Speed: %3d kmh", curSpeed);


When setting the speedString, not only does it fill the speedString (correctly) but it also overwrites parts of the locations string.

Any ideas as to why this is happening? It's really doing my head in because I cant see why it is doing it. There are other functions before and after this problem area setting strings fine :confused:

Thanks for any help.
 
Back
Top Bottom