Skip to content

Instantly share code, notes, and snippets.

@CrBoy
Created January 16, 2014 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CrBoy/8453684 to your computer and use it in GitHub Desktop.
Save CrBoy/8453684 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
void f1(const char *filename);
int main(int argc, const char *argv[])
{
if(argc<2) return 0;
f1(argv[1]);
return 0;
}
void f1(const char *filename)
{
char buffer[4096]; // Q_________Q
size_t len = strlen(filename);
size_t size = len > 4096 ? len : 4096;
strncpy(buffer, filename, size);
char *p = buffer;
while(*p != '\0'){
if(*p >= 'a' && *p <= 'z')
*p -= 'a' - 'A';
p++;
}
printf("%s", buffer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment