Skip to content

Commit

Permalink
fixes nim-lang#588; Change fgets parameter type to ptr UncheckedArray…
Browse files Browse the repository at this point in the history
…[char]
  • Loading branch information
demotomohiro committed Feb 20, 2025
1 parent d0b5a0b commit 78fed64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/std/syncio.nim
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ proc writeLine*(f: var File; s: string) =

const bufsize = 80

proc fgets(str: out array[bufsize, char]; n: int32; f: File): cstring {.
proc fgets(str: ptr UncheckedArray[char]; n: int32; f: File): cstring {.
importc: "fgets", header: "<stdio.h>".}

proc addReadLine*(f: File; s: var string): bool =
result = false
var buf: array[bufsize, char]
while fgets(buf, bufsize.int32, f) != nil:
while fgets(cast[ptr UncheckedArray[char]](addr buf[0]), bufsize.int32, f) != nil:
result = true
var done = false
for i in 0 ..< bufsize:
Expand Down

0 comments on commit 78fed64

Please sign in to comment.