paraboul / libapenetwork-archive Goto Github PK
View Code? Open in Web Editor NEWCross-platform Async network lib
Cross-platform Async network lib
I was playing around with ape_buffer, and I noticed that append_string_n, did not have the result that I anticpated. But maybe I misunderstood it's usage.
The code below is a small test to reproduce my situation.
/*
gcc -g test_buffer.c -o test_buffer -isystem ../libapenetwork/ -L ../libapenetwork/ -lnativenetwork
*/
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "ape_buffer.h"
#define TEXT "Anthony Catel"
int main( int argc, char ** argv ) {
buffer * string;
string = NULL;
string = buffer_new( 6 );
memset(string->data, '\0', string->size );
// should append on a fresh buffer
buffer_append_string_n( string, TEXT, 2 );
assert( strcmp( (char *) string->data, "An" ) == 0 && string->used == 2 ); // becomes Ant
// should append some tokens on a used buffer
buffer_append_string_n( string, TEXT, 3 );
assert( strcmp( (char *) string->data, "AnAnt" ) == 0 && string->used == 5 ); // becomes AnAnt
// should append some tokens on a almost full buffer
buffer_append_string_n( string, TEXT, 1 );
assert( strcmp( (char *) string->data, "AnAntA" ) == 0 && string->used == 6 ); // becomes AnAntAn
return 0;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.