FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
October 01, 2005

Managed String Library for C

(Page 3 of 7)

October, 2005: Managed String Library for C

Listing 2

#include <stdlib.h>
#include <stdio.h>
#include "safestr.h"
#include "xxl.h"

int main(int argc, char *argv[]) {
  safestr_t str1;
  safestr_t str2;

  XXL_TRY_BEGIN {   
    str1 = safestr_alloc(12, 0);
    str2 = safestr_create("hello, world\n", 0);
    safestr_copy(&str1, str2);
    safestr_printf(str1);
    safestr_printf(str2);
  }
  XXL_CATCH (SAFESTR_ERROR_OUT_OF_MEMORY) {
    printf("safestr out of memory.\n");
  }
  XXL_EXCEPT {
    printf("string operation failed.\n");
  }
  XXL_TRY_END;

  return 0;
}

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK