Skip to content

Instantly share code, notes, and snippets.

View NeverDie-iOS's full-sized avatar
🎯
Focusing

HyunSoo-Lee NeverDie-iOS

🎯
Focusing
  • 05:40 (UTC +09:00)
View GitHub Profile
@JCSooHwanCho
JCSooHwanCho / FileIO.swift
Last active June 20, 2024 02:26
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)] // 인덱스 범위 넘어가는 것 방지