Subject: Lesson in C / mktemp
To: None <netbsd-help@netbsd.org>
From: Patrick Welche <prlw1@cam.ac.uk>
List: netbsd-help
Date: 09/21/1998 15:54:52
Just out of curiosity, can someone explain to me why I had to do this:

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

int main()
{
  char *foo="rfbXXXXXX", *bar;

  printf("Before\n");
  bar=strdup(foo);
  mktemp(bar);
  printf("After\n");

  return 0;
}

when I think all I wanted to do was this:

#include <stdio.h>
#include <stdlib.h>

int main()
{
  char *foo="rfbXXXXXX";

  printf("Before\n");
  mktemp(foo);
  printf("After\n");

  return 0;
}

This second method core dumps in __gettemp with libc.so.12.32. I don't
want to reuse the template...

And from another list... What is the difference between int **val and
int (*val)[] ?

Cheers,

Patrick


(BTW I don't want to know about mktemp vs mkstemp :)