March 2014 update

This commit is contained in:
Ingy döt Net 2014-04-02 16:56:35 +00:00
parent 09687c4926
commit a25938f123
1846 changed files with 21876 additions and 5203 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;
}