aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2019-09-04 20:29:20 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2019-09-04 20:29:20 -0400
commitd1a1990c4177653fd2379c227142e6208ecfc20d (patch)
tree1ca9468b96a7bdfae79753913cf052d986f014c3 /README.md
parent06087b10ec7a897ad48db83f7f33a8fc11fa9341 (diff)
downloadlibctemplates-d1a1990c4177653fd2379c227142e6208ecfc20d.tar.gz
libctemplates-d1a1990c4177653fd2379c227142e6208ecfc20d.tar.bz2
libctemplates-d1a1990c4177653fd2379c227142e6208ecfc20d.zip
Fix typos in headers
Diffstat (limited to 'README.md')
-rw-r--r--README.md18
1 files changed, 10 insertions, 8 deletions
diff --git a/README.md b/README.md
index 043aca3..28bf1b5 100644
--- a/README.md
+++ b/README.md
@@ -159,6 +159,7 @@ For example:
*output*
Output: Hello, world!
+ Length: 13
### Variable substitution
@@ -168,7 +169,9 @@ For example:
*main.c*
- #include <ctemplate.h>
+ #include <ctemplates.h>
+ #include <stdio.h>
+ #include <stdlib.h>
int main(){
/*
@@ -185,11 +188,13 @@ For example:
}
fseek(fp,0,SEEK_END);
size_t file_len = ftell(fp);
+ fseek(fp,0,SEEK_SET);
char template[file_len];
fread(template,sizeof(char),file_len,fp);
struct TMPL_templates* t;
struct TMPL_varlist* vl;
+ size_t dummy;
/*
Render the template without a variable named "varname"
@@ -201,9 +206,8 @@ For example:
*/
t = TMPL_alloc_template(template);
vl = TMPL_alloc_varlist();
- size_t dummy;
char* without_variable = TMPL_render(t,vl,&dummy);
- printf("Without variable: %s\n",without_variable);
+ printf("Without variable:\n%s\n",without_variable);
TMPL_free_template(t);
TMPL_free_varlist(vl);
@@ -215,9 +219,8 @@ For example:
t = TMPL_alloc_template(template);
vl = TMPL_alloc_varlist();
TMPL_add_var_to_varlist(vl,"varname","Hello, world!");
- size_t dummy;
char* with_variable = TMPL_render(t,vl,&dummy);
- printf("With variable:%s\n",with_variable);
+ printf("With variable:\n%s\n",with_variable);
TMPL_free_template(t);
TMPL_free_varlist(vl);
@@ -229,7 +232,6 @@ For example:
Without variable:
Value is:optional default
-
With variable:
Value is:Hello, world!
@@ -252,7 +254,7 @@ If and elseif statements check if strings are the same. They do a strcmp(), so b
#include <stdlib.h>
#include <stdio.h>
- #include <ctemplate.h>
+ #include <ctemplates.h>
int main(){
/*
@@ -342,7 +344,7 @@ only variables that have been added to the namespace are accessible in the loop.
#include <stdlib.h>
#include <stdio.h>
- #include <ctemplate.h>
+ #include <ctemplates.h>
int main(){
/*