Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C Structs

Name: Anonymous 2009-03-24 12:22

Hi fags.

I need to know how portable c structs are for data transmission: are the fields in a fixed position determined by some standard?

Name: Anonymous 2009-03-26 21:02

>>50
here, i made your code a bit more readable for you:
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>

char *strdupv(int count, ...)
{ va_list ap;
  char *r = NULL, **s = malloc(count * sizeof(char *));
  if(s)
  { int i, n = 0;
    va_start(ap, count);
    for(i = 0; i < count; ++i)
    { s[i] = va_arg(ap, char *);
      n += strlen(s[i]); }
    va_end(ap);
    r = malloc(n + 1);
    if(r) for(*r = i = 0; i < count; ++i) strcat(r, s[i]);
    free(s); }
  return r; }

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List