MCPcopy Create free account
hub / github.com/WheretIB/nullc / Input

Function Input

NULLC/translation/std_io_bind.cpp:61–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61int Input(NULLCArray<char > data, void* unused)
62{
63 char buffer[2048];
64
65 if(fgets(buffer, 2048, stdin))
66 {
67 char *pos = strchr(buffer, '\n');
68 if(pos)
69 *pos = '\0';
70 }
71 unsigned int len = (unsigned int)strlen(buffer) + 1;
72 char *target = data.ptr;
73 for(unsigned int i = 0; i < (data.size < len ? data.size : len); i++)
74 target[i] = buffer[i];
75 buffer[data.size-1] = 0;
76
77 return ((unsigned int)len < data.size ? len : data.size);
78}
79
80void Input(int * num, void* unused)
81{

Callers

nothing calls this directly

Calls 1

strchrFunction · 0.85

Tested by

no test coverage detected