Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,14 @@
import core.stdc.string;
extern(C) bool query(char *data, size_t *length) pure nothrow {
immutable text = "Here am I";
if (*length < text.length) {
*length = 0; // Also clears length.
return false;
} else {
memcpy(data, text.ptr, text.length);
*length = text.length;
return true;
}
}

View file

@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdbool.h>
extern bool query(char *data, size_t *length);
int main() {
char buffer[1024];
size_t size = sizeof(buffer);
if (query(buffer, &size))
printf("%.*s\n", size, buffer);
else
puts("The call to query has failed.");
return 0;
}