#openFile stackoverflow error ?

1 messages · Page 1 of 1 (latest)

clever pelican
#

hello ! I'm not doing anything crazy, just opening a file but I keep getting stackoverflow errors and I actually have no idea of how opening a file can cause this type of error

const std = @import("std");

pub fn main() !void {
    var file = try std.fs.cwd().openFile("test.txt", .{});
    defer file.close();
    std.debug.print("{!}\n", .{file});
}

how much did i f up is those 3 lines ???

thanks you for your help !

languid tangle
#

looks correct to me 🤔

#

can you show the error

clever pelican
#

oops forgot to include it

PS C:\Users\nicolas\Desktop\zig-learning> zig build run
Stack Overflow
Segmentation fault at address 0x60612a0350
Segmentation fault at address 0x60612a0ed0
Segmentation fault at address 0x60612a0a50
Segmentation fault at address 0xrun
└─ run zig-learning failure
error: the following command exited with error code 5:
C:\Users\nicolas\Desktop\zig-learning\zig-out\bin\zig-learning.exe
Build Summary: 3/5 steps succeeded; 1 failed (disable with --summary none)
run transitive failure
└─ run zig-learning failure
error: the following build command failed with exit code 1:
C:\Users\nicolas\Desktop\zig-learning\.zig-cache\o\6d7fb88cb5b078453722cb9f8cbaab9f\build.exe C:\zig-windows-x86_64-0.13.0\zig.exe C:\Users\nicolas\Desktop\zig-learning C:\Users\nicolas\Desktop\zig-learning\.zig-cache C:\Users\nicolas\AppData\Local\zig --seed 0xf1772ece -Z4487565686be7adf run
PS C:\Users\nicolas\Desktop\zig-learning>
wraith heath
#

FWIW I don't recommend keeping your Zig project on your Desktop. this normally involves OneDrive, which (like other cloud-connected solutions like iCloud) are notoriously unfriendly to development. If you do want it there, and you're on Windows 11, look into using Windows' Developer mode.

#

BTW I don't see any stack overflow error in that output.

clever pelican
#

on the second line it said Stack overflow so I assumed it was a stack overflow error but I might be wrong

brave heath