Skip to content

A function to take input from user within a specified time, and displaying a timer. Based on CS50's library.

Notifications You must be signed in to change notification settings

Quarz0/get-timed-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

get-timed-string

Reads a line of text from standard input, within a specified time (t) in seconds, and returns it as a string (char *), sans trailing newline character. (Ergo, if user inputs only "\n", returns "" not NULL.) Returns NULL * upon error or no input whatsoever (i.e., just EOF), or if the user failed to provided an input within the specified time. Leading and trailing whitespace is not ignored. Stores string on heap (via malloc); memory must be freed by caller to avoid leak. With each key pressed, the contents of the current line in the terminal window is rewritten (the timer and the text entered by the user) to update the remaining time left.

This function is a modified version of CS50's library's (https://manual.cs50.net/library/) GetString function. Supports Windows only since it makes use of "conio" library.

Current Known Issue(s): Breaks when the string entered by the user exceeds the terminal column width.

About

A function to take input from user within a specified time, and displaying a timer. Based on CS50's library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages