Can't store char array to node value
I have this bit of code, but it's failing. The error is something like "Access violation writing location"
1 2 3 4 5 6 7
|
struct Node {
TYPE val; // TYPE is defined as void*
};
char buffer[50];
fgets(buffer, 50, f); // f is FILE *f
node->val = buffer;
|
Last edited on
Make sure the buffer has not gone out of scope for as long as you are using node->val.
edit: okay figure it out. The node was null which is why it wasn't working >.<
Last edited on
Topic archived. No new replies allowed.