Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the string format %80[^,] mean in C?

Given the following lines:

char szInline[80];
char szDescription[80] = { NULL };
float fCost = 0;
sscanf (szInline, "%80[^,], %f", szDescription, &fCost);

What does the %80[^,] do?

like image 465
Jack Welch Avatar asked Jan 29 '26 14:01

Jack Welch


1 Answers

Read at most 80 chars up to the next , comma.

Btw, the szDescription buffer is too small by 1.

like image 96
dxiv Avatar answered Jan 31 '26 06:01

dxiv