progs/C5.c
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Fri, 10 Oct 2014 12:39:11 +0100
changeset 234 17e0efbec5d0
child 235 75e32cd57ef0
permissions -rw-r--r--
added a more sophisticated formatstring program
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
234
17e0efbec5d0 added a more sophisticated formatstring program
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
#include<stdio.h>
17e0efbec5d0 added a more sophisticated formatstring program
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
#include<string.h>
17e0efbec5d0 added a more sophisticated formatstring program
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
17e0efbec5d0 added a more sophisticated formatstring program
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
int main(int argc, char **argv)
17e0efbec5d0 added a more sophisticated formatstring program
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
{  char buf [100];
17e0efbec5d0 added a more sophisticated formatstring program
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
   snprintf(buf, sizeof buf, argv [1]);
17e0efbec5d0 added a more sophisticated formatstring program
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
   printf ("Input: %s \n", buf);
17e0efbec5d0 added a more sophisticated formatstring program
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
}