I'm sorry about this email, it is quite off-topic, but I know a lot of
good hackers hang out here, and I'm quite stuck on this little problem.

I have been going at this problem from a multitude of angles, and I
settled on using pass-by-reference after trial and error with returning
char*

this code;
#include <stdio.h>
#include <iostream>
void test(char ***foo) {
  **foo = strtok("test1,test2",",");
}
void test2(char ***foo) {
  **foo = "Spin the big yellow thing";
}

int main() {
  char ** bar;
  test2(&bar);
  printf("%s\n", *bar);
  test(&bar);
  printf("%s\n", *bar);
  return 0;
}

in this;
results Spin the big yellow thing
Segmentation fault

If anyone can give me a tip about why this segfaults when using strtok,
I'd be very happy :)

I have no backtrace, as my system doesn't have gdb installed, but I will
install it later on (tomorrow) if I get a chance.

Cheers,
-- 
Morten

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to