Skip to content

Instantly share code, notes, and snippets.

@tuxmartin
Created April 17, 2016 13:00
Show Gist options
  • Save tuxmartin/4a15b6a5f7ff3a627942f3acd11aad8f to your computer and use it in GitHub Desktop.
Save tuxmartin/4a15b6a5f7ff3a627942f3acd11aad8f to your computer and use it in GitHub Desktop.
// Kompilace: gcc -o test test.c
#include <stdio.h>
#include <string.h>
int main(void) {
int i;
char nazev[] = "test_";
for (i = 0; i < 5; i++) {
char tmp[20];
memset(tmp, 0, sizeof(tmp));
strcat(tmp, nazev);
char pocitadlo[5];
sprintf(pocitadlo, "%d", i);
strcat(tmp, pocitadlo);
strcat(tmp, ".bmp");
printf("%s\n", tmp);
}
}
[14:59:38] martin@martin:/tmp$ ./test
test_0.bmp
test_1.bmp
test_2.bmp
test_3.bmp
test_4.bmp
[14:59:39] martin@martin:/tmp$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment