Created
March 28, 2017 09:55
-
-
Save lotas/0f4fa315331d8fae2a6de904c841e247 to your computer and use it in GitHub Desktop.
strtoint.c colors
This file contains 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> | |
int main(int argc, char **argv) { | |
if (argc < 2) { | |
printf("No input\n"); | |
return 1; | |
} | |
printf("Input: %s \n", argv[1]); | |
char *ptr; | |
long n = strtol(argv[1], &ptr, 10); | |
printf("Converted: \"%c[1;33m%s\" -> %c[1;31m%ld \n", 27, argv[1], 27, n); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment