From e17f8a4dd6fdab3eab7715fd5f6422f45adf9afd Mon Sep 17 00:00:00 2001 From: a92126 <182859762@qq.com> Date: Wed, 20 Nov 2024 18:01:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89getEndPos=E4=BD=BF=E7=94=A8ls?= =?UTF-8?q?eek=EF=BC=8C=E5=9B=A0=E4=B8=BAgetEndPos=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=94=A8statx=EF=BC=8C=E8=BF=99=E4=B8=AA=E5=9C=A8debian10?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E2=80=A6=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/cheat-builder/make-acl.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/cheat-builder/make-acl.zig b/tools/cheat-builder/make-acl.zig index ba41553..3fece88 100644 --- a/tools/cheat-builder/make-acl.zig +++ b/tools/cheat-builder/make-acl.zig @@ -120,9 +120,14 @@ pub fn main() !void { } fn readAll(allocator: Allocator, file: File) ![]u8 { - const file_size: usize = @intCast(try file.getEndPos()); + //const file_size: usize = @intCast(try file.getEndPos()); + //const file_contents = try allocator.alloc(u8, file_size); + try file.seekFromEnd(0); + const file_size = try file.getPos(); const file_contents = try allocator.alloc(u8, file_size); + try file.seekTo(0); + const readed = try file.readAll(file_contents); if (readed != file_size) { return error.EndOfStream;