Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cs50/libcs50
This is CS50's Library for C.
https://github.com/cs50/libcs50
c
Last synced: 7 days ago
JSON representation
This is CS50's Library for C.
- Host: GitHub
- URL: https://github.com/cs50/libcs50
- Owner: cs50
- License: gpl-3.0
- Created: 2012-07-15T05:02:21.000Z (over 12 years ago)
- Default Branch: main
- Last Pushed: 2024-06-22T22:39:10.000Z (7 months ago)
- Last Synced: 2024-12-26T04:06:31.423Z (14 days ago)
- Topics: c
- Language: C
- Homepage: https://cs50.readthedocs.io/libraries/cs50/c/
- Size: 300 KB
- Stars: 1,803
- Watchers: 149
- Forks: 866
- Open Issues: 36
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CS50 Library for C
[![Build Status](https://travis-ci.org/cs50/libcs50.svg?branch=master)](https://travis-ci.org/cs50/libcs50)
## Development
`make`: builds dynamic library
`make deb`: builds source deb
`make install`: installs the library under `/usr/local` by default (set `DESTDIR` to change that)
## Installation
### Ubuntu
```
$ curl -s https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | sudo bash
$ sudo apt-get install libcs50
```### Fedora
```
$ curl -s https://packagecloud.io/install/repositories/cs50/repo/script.rpm.sh | sudo bash
$ yum install libcs50
```### From Source (Linux and Mac)
1. Download the latest release from https://github.com/cs50/libcs50/releases
1. Extract `libcs50-*.*`
1. `cd libcs50-*`
1. `sudo make install`By default, we install to `/usr/local`. If you'd like to change the installation location, run
`sudo DESTDIR=/path/to/install make install` as desired.## Troubleshooting
1. If, when compiling a program, you see `/usr/bin/ld: cannot find -lcs50`:
Add `export LIBRARY_PATH=/usr/local/lib` to your `.bashrc`.
1. If, when compiling a program, you see `fatal error: 'cs50.h' file not found`:
Add `export C_INCLUDE_PATH=/usr/local/include` to your `.bashrc`.
1. If, when executing a program, you see `error while loading shared libraries: libcs50.so.8: cannot open shared object file: No such file or directory`:
Add `export LD_LIBRARY_PATH=/usr/local/lib` to your `.bashrc`.Close and reopen any terminal windows.
## Usage
Link with `-lcs50`.
#include
...
char c = get_char("Prompt: ");
double d = get_double("Prompt: ");
float f = get_float("Prompt: ");
int i = get_int("Prompt: ");
long l = get_long("Prompt: ");
string s = get_string("Prompt: ");// deprecated as of fall 2017
long long ll = get_long_long("Prompt: ");## Documentation
See `man get_*` after installation, or [CS50 Reference](https://reference.cs50.net/cs50/)!
## TODO
* Add tests.
## Contributors
* [Chad Sharp](https://github.com/crossroads1112)
* [Emrul Hasan Zawad](https://github.com/ehzShelter)
* [Ivan Jasenov](https://github.com/IvanJasenov)
* [Kareem Zidane](https://github.com/kzidane)