#include #include #include #define P0 "\xDB\xB0" #define P1 "\xDB\xB1" #define P2 "\xDB\xB2" #define P3 "\xDB\xB3" #define P4 "\xDB\xB4" #define P5 "\xDB\xB5" #define P6 "\xDB\xB6" #define P7 "\xDB\xB7" #define P8 "\xDB\xB8" #define P9 "\xDB\xB9" #define PD "\xd9\xab" #define PT "\xd9\xac" void check_sscanf (const char *s, const char *format, const float n) { float f; sscanf (s, format, &f); if (f != n) printf ("got %f expected %f \n", f, n); } int main () { setlocale (LC_ALL, "fa_IR"); check_sscanf (P3 PD P1 P4, "%I8f", 3.14); check_sscanf (P3 PT P1 P4 P5, "%I'f", 3145); check_sscanf (P3 PD P1 P4 P1 P5 P9, "%If", 3.14159); check_sscanf ("-" P3 PD P1 P4 P1 P5, "%If", -3.1415); check_sscanf ("+" PD P1 P4 P1 P5, "%If", +.1415); check_sscanf (P3 PD P1 P4 P1 P5 "e+" P2, "%Ie", 3.1415e+2); return 0; }