GitXplorerGitXplorer
c

libcs50

public
1715 stars
849 forks
35 issues

Commits

List of commits on branch main.
Unverified
06deae221c2d0456477a3f621df513d968239462

support up to fedora 40 and ubuntu nobal, bump version number

rrongxin-liu committed 3 months ago
Unverified
31232a0c7bf98520fda7722f1bf286cf3dd0c0be

updated actions/github-script to version v7

rrongxin-liu committed 5 months ago
Unverified
c4b678246bcb75aef3eddbad346030e73499bfc0

updated action/checkout to v4

rrongxin-liu committed 7 months ago
Unverified
6d916ef457528b67bee2ac3e5ea3735acac19669

fedora 38

rrongxin-liu committed a year ago
Verified
c8b9733335ab90f1ce49f230d819d5d15b27747a

Merge pull request #290 from cs50/new-release

rrongxin-liu committed a year ago
Verified
bf29ed74df39f719d21c9cdd0f1594db16a34fbd

Update Makefile

rrongxin-liu committed a year ago

README

The README file for this repository.

CS50 Library for C

Build Status

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
  2. Extract libcs50-*.*
  3. cd libcs50-*
  4. 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.
  2. 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.
  3. 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 <cs50.h>

...
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!

TODO

  • Add tests.

Contributors