Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_LEN 16
- char val[MAX_LEN+1]; // room for
- sscanf(buf, "%"MAX_LEN"s", val);
- #define STRINGIFY(x) #x
- #define TOSTRING(x) STRINGIFY(x)
- #define AT __FILE__ ":" TOSTRING(__LINE__)
- #define VERSION_MAJOR 4
- #define VERSION_MINOR 47
- #define VERSION_STRING "v" #VERSION_MAJOR "." #VERSION_MINOR
- #define VERSION_MAJOR 4
- #define VERSION_MINOR 47
- #define STRINGIZE2(s) #s
- #define STRINGIZE(s) STRINGIZE2(s)
- #define VERSION_STRING "v" STRINGIZE(VERSION_MAJOR)
- "." STRINGIZE(VERSION_MINOR)
- #include <stdio.h>
- int main() {
- printf ("%sn", VERSION_STRING);
- return 0;
- }
- sscanf(buf, "%" #MAX_LEN "s", val);
- #define STR1(x) #x
- #define STR(x) STR1(x)
- sscanf(buf, "%" STR(MAX_LEN) "s", val);
- #define MAX_LEN 16
- #define MAX_LEN_S "16"
- char val[MAX_LEN+1];
- sscanf(buf, "%"MAX_LEN_S"s", val);
- strncpy(val, buf, MAX_LEN);
- val[MAX_LEN] = '