Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Error in my read data

$
0
0
char temp[20];
sscanf(buffer, "%[^\n]", temp, buffer);
		if(isdigit(temp[0]))// check if what read in is a digit
		{
			while(r < 8)
			{
				sscanf(temp, "%*d%d", olympians[i].base_values[r]);

				for(int c = 0; c < 12; c++){
					sscanf(temp, "%d", olympians[i].scores[r][c]);
					tempScore[r] += olympians[i].scores[r][c];
				}
				tempScore[r] /= 12;
				if((olympians[i].base_values[r]) <= 3.1){
					tempScore[r] /= 2;
					tempScore[r] += (olympians[i].base_values[r]);
				}
				else
					tempScore[r] += (olympians[i].base_values[r]);

				olympians[i].total_scores[i] += tempScore[r]; 
			r++;
			}
		}


txt line im trying to read in:
1 7.5 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3

is something wrong with
sscanf(temp, "%*d%d", olympians[i].base_values[r]);


because the compiler crash whenever i debugged this part

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>