Skip to content

Commit 0223f30

Browse files
committed
Update docs
1 parent 02bef28 commit 0223f30

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ cprintf("{}\n", F(i,"06")); // Equal to printf("%06d\n", i);
88
```
99
And, now we have `csprintf()`, it supports T() F() but don't support color.
1010
On linux, cprintf() and cfprintf() will auto disable color when output to a pipe.
11+
# Warning:
12+
cprintf is not more secure than printf(), and, please always use unchangable format string and make sure there's not extra {}!
13+
For example:
14+
```C
15+
printf("%s%s%s%s","xxxxx"); // Boom!
16+
cprintf("{}{}{}{}","xxxxx"); // Also boom!!!!!!
17+
printf("%s","xxxxx"); // Good!
18+
cprintf("{}","xxxxxx"); // Also good :)
19+
```
1120
# Let's make a colorful world!
1221
# What's this?
1322
We often use ASCII color like `\033[0m` when developing. But it's hard to remember them.

test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,5 @@ int main(void)
105105

106106
int i = 0;
107107
cprintf("{}\n", T(i));
108+
cprintf("{}\n", "{}{}{}{}");
108109
}

0 commit comments

Comments
 (0)