Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View file

@ -0,0 +1,2 @@
: read-file "foo.txt" GET-FILE TYPE ;
read-file

View file

@ -1 +1,2 @@
(require racket/file)
(file->string "foo.txt")

View file

@ -1,18 +1,14 @@
const std = @import("std");
const File = std.fs.File;
pub fn main() (error{OutOfMemory} || File.OpenError || File.ReadError)!void {
pub fn main() !void {
var gpa: std.heap.GeneralPurposeAllocator(.{}) = .{};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
const cwd = std.fs.cwd();
var file = try cwd.openFile("input_file.txt", .{ .mode = .read_only });
var file = try std.fs.cwd().openFile("input_file.txt", .{});
defer file.close();
const file_content = try file.readToEndAlloc(allocator, comptime std.math.maxInt(usize));
const file_content = try file.readToEndAlloc(allocator, (try file.stat()).size);
defer allocator.free(file_content);
std.debug.print("Read {d} octets. File content:\n", .{file_content.len});