Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

Repository files navigation

Get_Next_Line

Table of Contents

Objective

  • Gain a deeper understanding of memory allocations, manipulation of a buffer, and the use of static variables in C
  • Create a function that reads and stores a line from a file(s) everytime function is called.
    • Returns 1 on success, -1 on error, and 0 when file has been completely read
    • Note: Calling the function will return the next line in the file.

Usage

  1. Open terminal and clone repository into desired directory location
  1. Open directory containing all files
  2. Type "make" into command line to create executable program
  • Note: you should see the executable "test_gnl" being created after a few seconds of compiling
  1. Run executable program with the file path as an argument of the program
  • Ex. type "./test_gnl Ralph_statement"
  • Note: main program is made to run function until entire file is read and displayed on the terminal, you will need to modify file if you only wish to read a single line
  1. type "make fclean" into command line to erase executable program
  2. Extra:
  • You can simply use the get_next_line() function by including its prototype into a header file or into your own program and include the source code. However, functions from the library is used in this function, so you will need to include that as well
  • If you would like to see if the program has any memory leaks, you can uncomment the line "system("leaks test_gnl")" and the executable will display the leak information from the program

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages