Updated the interface for the TStringGetStringRange function. It will now fill a buffer, leaving a null byte at the end, with as many characters as it can depending on the supplied buffer's size.
This commit is contained in:
+7
-9
@@ -7,6 +7,7 @@
|
||||
int main(int argc, char** argv) {
|
||||
char input[1024] = { 0 };
|
||||
char glyph[8] = { 0 };
|
||||
char buffer[11] = { 0 };
|
||||
char* file;
|
||||
size_t bytesRead;
|
||||
|
||||
@@ -90,11 +91,12 @@ int main(int argc, char** argv) {
|
||||
|
||||
int count = strtol(input, NULL, 10);
|
||||
|
||||
char* text = TStringGetStringRange(num, count, string);
|
||||
//char* text = TStringGetStringRange(num, count, string);
|
||||
TStringGetStringRange(string, num, count, sizeof buffer, buffer);
|
||||
|
||||
printf("Returned String:\n'%s'\n", text);
|
||||
|
||||
free(text);
|
||||
printf("Returned String:\n'%s'\n", buffer);
|
||||
for (int i = 0; i < sizeof buffer; i++) printf("%02X ", buffer[i] & 0xFF);
|
||||
printf("\n");
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -102,10 +104,6 @@ int main(int argc, char** argv) {
|
||||
|
||||
TStringAppendText(input, string);
|
||||
}
|
||||
//fgets(glyph, 10, stdin);
|
||||
|
||||
//glyph[strlen(glyph) - 1] = 0;
|
||||
|
||||
//printf("Width %d byte(s).\n", GetGlyphByteWidth(glyph));
|
||||
|
||||
TStringFree(string);
|
||||
}
|
||||
Reference in New Issue
Block a user