Skip to content

Instantly share code, notes, and snippets.

@juancarlospaco
Last active May 27, 2024 18:06
Show Gist options
  • Save juancarlospaco/aa16aa332e07f1de9139de1e6ae4f1a0 to your computer and use it in GitHub Desktop.
Save juancarlospaco/aa16aa332e07f1de9139de1e6ae4f1a0 to your computer and use it in GitHub Desktop.
C print for Nim
proc printf*(format: cstring): cint {.importc, header: "<stdio.h>".}
proc fprintf*(stream: File, format: cstring): cint {.importc, header: "<stdio.h>".}
proc sprintf*(str: var cstring, format: cstring): cint {.importc, header: "<stdio.h>".}
proc vsprintf*(str: var cstring, format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
proc vfprintf*(stream: File, format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
proc vprintf*(format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
proc fputs*(str: char, stream: File): cint {.importc, header: "<stdio.h>".}
proc puts*(str: char): cint {.importc, header: "<stdio.h>".}
proc printf_s*(format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
proc fprintf_s*(stream: File, format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
proc wprintf*(format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
proc fwprintf*(stream: File, format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
proc wprintf_s*(format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
proc fwprintf_s*(stream: File, format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
proc fwrite*(formatstr: cstring, size: cuint, nmemb: cuint, stream: File): cint {.importc, header: "<stdio.h>".}
@Diviector
Copy link

proc printf*(format: cstring): cint {.importc, header: "<stdio.h>", varargs.}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment