I've got the following errors:
Error 1 error C2440: '=' : cannot convert from 'p_node *' to 'int'
Error 2 error C2227: left of '->fname' must point to class/struct/union/generic type
Error 2 is because of error 1.
But how do I get a temp-pointer to work? My code below is from a function that im calling within the program.
You're declaring 'temp' as a pointer to an int, but then making it point to a p_node. This is nonsensical.
You're also dereferencing a null pointer on line 8 (bad).
If 'temp' points to a p_node, then you should make it a p_node pointer. 'new' also returns a pointer, so you assign it to the pointer. You don't dereference the pointer:
1 2 3
p_node* temp = NULL; // note: p_node*.. not int*
temp = new p_node; // note: temp = ... not *temp =
Of course initializing to NULL can also be skipped: