version 1.1, 2011/05/03 14:29:52
|
version 1.2, 2011/05/03 15:41:00
|
Line 0
|
Line 1
|
|
#include <stdio.h> |
|
#include <string.h> |
|
#include <aitio.h> |
|
|
|
int |
|
main(int argc, char **argv) |
|
{ |
|
sarr_t *a = NULL; |
|
void *d = "MEOWeoeoeoeoe!!!"; |
|
|
|
a = io_sarrInit(10, 4); |
|
if (!a) { |
|
printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError()); |
|
return 1; |
|
} |
|
|
|
switch (argc) { |
|
case 4: |
|
io_sarrSet(a, 10, argv[3]); |
|
case 3: |
|
io_sarrSet(a, 6, argv[2]); |
|
io_sarrSet(a, 4, argv[2]); |
|
case 2: |
|
io_sarrSet(a, 3, argv[1]); |
|
io_sarrSet(a, 1, argv[1]); |
|
} |
|
|
|
printf(">>> a[1]=%s a[2]=%s a[3]=%s a[4]=%s a[6]=%s a[10]=%s\n", |
|
io_sarr(a, 1, char*), io_sarr(a, 2, char*), |
|
io_sarr(a, 3, char*), io_sarr(a, 4, char*), |
|
io_sarr(a, 6, char*), io_sarr(a, 10, char*)); |
|
printf(">>> array size=%d\n", io_sarrSize(a)); |
|
|
|
io_sarrDel(a, 6); |
|
io_sarrDel(a, 9); |
|
io_sarrDel(a, 10); |
|
printf(">>> a[1]=%s a[2]=%s a[3]=%s a[4]=%s a[6]=%s a[10]=%s\n", |
|
io_sarr(a, 1, char*), io_sarr(a, 2, char*), |
|
io_sarr(a, 3, char*), io_sarr(a, 4, char*), |
|
io_sarr(a, 6, char*), io_sarr(a, 10, char*)); |
|
printf(">>> array size=%d\n", io_sarrSize(a)); |
|
|
|
io_sarrSet(a, 240, d); |
|
printf(">>> array size=%d s[240]=%s\n", io_sarrSize(a), io_sarrGet2(a, 240)); |
|
io_sarrSet(a, 240, d); |
|
printf(">>> array size=%d s[240]=%s\n", io_sarrSize(a), io_sarr(a, 240, char*)); |
|
printf(">>> array size=%d s[240]=%s\n", io_sarrSize(a), io_sarrGet2(a, 240)); |
|
|
|
io_sarrVacuum(a); |
|
printf("vacuum:: a[1]=%s a[2]=%s a[3]=%s a[4]=%s a[6]=%s a[10]=%s\n", |
|
io_sarr(a, 1, char*), io_sarr(a, 2, char*), |
|
io_sarr(a, 3, char*), io_sarr(a, 4, char*), |
|
io_sarr(a, 6, char*), io_sarr(a, 10, char*)); |
|
printf("vacuum:: array size=%d\n", io_sarrSize(a)); |
|
|
|
io_sarrGrow(a, 20); |
|
printf("grow:: array size=%d\n", io_sarrSize(a)); |
|
printf("grow:: a[1]=%s a[2]=%s a[3]=%s a[4]=%s a[6]=%s a[10]=%s\n", |
|
io_sarr(a, 1, char*), io_sarr(a, 2, char*), |
|
io_sarr(a, 3, char*), io_sarr(a, 4, char*), |
|
io_sarr(a, 6, char*), io_sarr(a, 10, char*)); |
|
|
|
io_sarrGrow(a, 1); |
|
io_sarrGrow(a, 2); |
|
printf("shrink:: array size=%d\n", io_sarrSize(a)); |
|
printf("shrink:: a[1]=%s a[2]=%s\n", io_sarr(a, 1, char*), io_sarr(a, 2, char*)); |
|
|
|
io_sarrDestroy(&a); |
|
return 0; |
|
} |