๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ 42seoul ํ”„๋กœ์ ํŠธ

[42seoul] Get_next_line : \n(๊ฐœํ–‰) ๋‹จ์œ„๋กœ ํŒŒ์ผ ์ฝ๊ธฐ

by kukim 2021. 10. 28.

๐Ÿ“  Get_next_line

@42seoul : (2020.07.01 ~ 2020.07.15)

๐Ÿ“– About

  • ์ด ํ”„๋กœ์ ํŠธ๋Š” fd์— ์ €์žฅ๋œ ํŒŒ์ผ ๋‚ด์šฉ์„ "\n" ๊ฐœํ–‰ ๋‹จ์œ„ ์ค„๋กœ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜๋ฅผ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค.(The aim of this project is to make you code a function that returns a line
    ending with a newline, read from a file descriptor.)
Type Function Description
file read get_next_line(int fd, char **line) Write a function which returns a line read from a file descriptor, without the newline.

๐Ÿ“ Review

  • fd ๊ด€๋ฆฌ์™€ static variable์„ ํ™œ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋ฐฐ์šธ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
  • python์˜ read.csv() ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ ๋‹ค๊ณ  ํ–ˆ์„ ๋•Œ ๋‹จ์ˆœํžˆ "\n" ๊ฐœํ–‰ ๋‹จ์œ„๋กœ ํ–‰์„ ๋‚˜๋ˆ„๊ณ  sep(๊ตฌ๋ถ„์ž) ๋‹จ์œ„๋กœ ์—ด์„ ๋‚˜๋ˆŒ ์ˆ˜ ์žˆ๋Š”๋ฐ C์—์„œ๋„ ์ด์ œ Libft ํ”„๋กœ์ ํŠธ์™€ Get_next_line ํ”„๋กœ์ ํŠธ ํ•จ์ˆ˜๋ฅผ ํ•ฉ์น˜๋ฉด ์‰ฝ๊ฒŒ read.csv() ๊ฐ™์€ ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.

๐Ÿ Run

  • Read File
    1. Iris.csv(๋ถ“๊ฝƒ ๋ฐ์ดํ„ฐ)๋ฅผ "\n"๊ฐœํ–‰ ๋‹จ์œ„๋กœ ์ฝ๊ธฐ -> get_next_line()
    2. ๊ฐœํ–‰ ๋‹จ์œ„๋กœ ์ฝ์€ ๋ฐ์ดํ„ฐ user_output ์œผ๋กœ ์ €์žฅ
    3. diff user_output ./Iris.csv
get_next_line_fileread

๐Ÿ”— Reference

๐Ÿง‘๐Ÿป‍๐Ÿ’ป Author

kukim

ํƒœ๊ทธ

,

๋Œ“๊ธ€0