Created
February 17, 2019 12:24
-
-
Save int0x33/d95af4eb415f3f0ad8a2e76297e18fd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| enum { BUFFER_SIZE = 10 }; | |
| int main() { | |
| char buffer[BUFFER_SIZE]; | |
| int length = snprintf(buffer, BUFFER_SIZE, "%s%s", "long-name", "suffix"); | |
| if (length >= BUFFER_SIZE) { | |
| /* handle string truncation! */ | |
| } | |
| return EXIT_SUCCESS; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment