If you are aware of the
function you should be also aware of the
function. To read from the keyboard pass zero as first parameter (file descriptor stdin
loop to read single characters and store them in an array until a new line (
) occurs (user pressed the ENTER key). Store the number of characters read in a variable and/or terminate the string with a NULL byte.
Compare the two arrays. The first check is comparing the lengths which has been stored in variables after reading the user input. If they do not match, the comparison has failed. Otherwise iterate over the arrays using a
loop comparing each character until there is a mismatch (comparison failed) or the loop finishs (comparision succeeded).
to create the file to write the output.
If you need a description for the system functions, you can use the Linux man pages like read(2) - Linux manual page
]. They can be simply found by searching the web for "man 2 <function_name>". The "2" is the man page section for system calls. All functions from this section should be useable with ShellForge