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 18:49

HAY GUYS Check out my variadic strdup


#include <stdlib.h>
#include <stdarg.h>
#include <string.h>

char *strdupv(int count, ...) {
  va_list ap;
  int i,n=0;
  char *r,**s;

  s = malloc(count * sizeof(char*));
  if(!s)
    return NULL;

  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) {
    *r = 0;
    for(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