https://github.com/jmkim/uh.h
uh.h
https://github.com/jmkim/uh.h
Last synced: about 1 year ago
JSON representation
uh.h
- Host: GitHub
- URL: https://github.com/jmkim/uh.h
- Owner: jmkim
- Created: 2015-10-29T11:53:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-01T18:54:11.000Z (over 10 years ago)
- Last Synced: 2025-01-26T05:11:35.890Z (over 1 year ago)
- Language: C
- Homepage:
- Size: 133 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
```bash
### How to make a static library
gcc -c src/uh.c # output will be "uh.o", if you not use `-o output_file'.
mkdir lib
ar rc lib/libuh.a uh.o
# ar options
# r add new object to archive; in this case, "lib/libuh.a"
# c create archive if not exist
rm uh.o
### How to link a static library
gcc -L ./lib -luh your_source_file.c
# gcc options
# -L [where_the_library_is]
# -l [name_of_the_library (except prefix "lib" and extension)]
# example: to link "libuhfoo.a": -luhfoo
# to link "libuhbar.a": -luhbar
# to link both : -luhfoo -luhbar
```
```c
/*
example.c
Trim the input string
Author: Jongmin Kim
Written on October 29, 2015
*/
#include
#include "src/uh_fgets.h"
#include "src/uh_trim.h"
int main(void)
{
printf("Enter the string: ");
char str[100];
uh_fgets(stdin, str, 100);
printf(
"Trim the string..\n"
" all : \"%s\"\n"
" both : \"%s\"\n"
" lead only : \"%s\"\n"
" tail only : \"%s\"\n"
, uh_trim_all(str, " ")
, uh_trim_both(str, " ")
, uh_trim_leading(str, " ")
, uh_trim_trailing(str, " ")
);
return 0;
}
```