Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -1,20 +1,19 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn main() (error{OutOfMemory} || std.fs.File.OpenError || std.fs.File.ReadError || std.fs.File.WriteError)!void {
|
||||
pub fn main() !void {
|
||||
var gpa: std.heap.GeneralPurposeAllocator(.{}) = .{};
|
||||
defer _ = gpa.deinit();
|
||||
const allocator = gpa.allocator();
|
||||
|
||||
const cwd = std.fs.cwd();
|
||||
|
||||
var input_file = try cwd.openFile("input.txt", .{ .mode = .read_only });
|
||||
var input_file = try cwd.openFile("input.txt", .{});
|
||||
defer input_file.close();
|
||||
|
||||
var output_file = try cwd.createFile("output.txt", .{});
|
||||
defer output_file.close();
|
||||
|
||||
// Restrict input_file's size to "up to 10 MiB".
|
||||
var input_file_content = try input_file.readToEndAlloc(allocator, 10 * 1024 * 1024);
|
||||
const input_file_content = try input_file.readToEndAlloc(allocator, (try input_file.stat()).size);
|
||||
defer allocator.free(input_file_content);
|
||||
|
||||
try output_file.writeAll(input_file_content);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue