Skip to content

Instantly share code, notes, and snippets.

View NeverDie-iOS's full-sized avatar
๐Ÿ‘‹
Focusing

Hyunsoo-Lee NeverDie-iOS

๐Ÿ‘‹
Focusing
  • ๊ด‘์ฃผ๊ด‘์—ญ์‹œ ๋ถ๊ตฌ
  • 07:22 (UTC +09:00)
View GitHub Profile
@JCSooHwanCho
JCSooHwanCho / FileIO.swift
Last active March 19, 2025 05:13
psํ•  ๋•Œ ์ž…๋ ฅ์„ ํ•œ๊บผ๋ฒˆ์— ๋ฐ›๊ธฐ ์œ„ํ•œ ์œ ํ‹ธ๋ฆฌํ‹ฐ ํด๋ž˜์Šค. fread์˜ swift ๋ฒ„์ „.
import Foundation
final class FileIO {
private let buffer:[UInt8]
private var index: Int = 0
init(fileHandle: FileHandle = FileHandle.standardInput) {
buffer = Array(try! fileHandle.readToEnd()!)+[UInt8(0)] // ์ธ๋ฑ์Šค ๋ฒ”์œ„ ๋„˜์–ด๊ฐ€๋Š” ๊ฒƒ ๋ฐฉ์ง€