소스 검색

Added File.seek(offset)

MhdHejazi 9 년 전
부모
커밋
316c89afce
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      Sources/String+File.swift

+ 4 - 0
Sources/String+File.swift

@@ -26,6 +26,10 @@ extension String {
             fclose(pointer)
         }
         
+        public func seek(_ offset: Int) -> Bool {
+            return (fseek(pointer, offset, SEEK_SET) == 0)
+        }
+        
         public func read(_ data: inout [UInt8]) throws -> Int {
             if data.count <= 0 {
                 return data.count