Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copies every 4th chararacter out of the input string
- * Created to deal with MS Hotmail's problems
- * 2015 The Lightning Stalker
- */
- #include <stdio.h>
- #include <string.h>
- int main (int argc, char **argv)
- {
- char *stringin, *stringout;
- int i, j;
- if (argc == 2)
- {
- stringin = argv[1]; // stringin and stringout must be inited
- stringout = stringin; // to strlen(argv[1]) or else segfault!
- j = strlen(stringin) / 4;
- for (i = 0; i <= j; ++i)
- {
- stringout[i] = stringin[i * 4];
- }
- stringout[i] = '\0';
- printf("%s\n", stringout);
- }
- else
- {
- puts("Use like this:");
- printf("%s [string]\n", argv[0]);
- puts("Where [string] is the text to strip every even character.");
- }
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement