Typedef struct saving

Say I have a typedef struct with different variable types within it, it also looks at outside constants to determine which to use, a common struct, nothing fancy. During run time, I would like to be able to save an instance of this struct before running a function. Declare a new variable of that struct type, set it equal to current one used in function prior to doing anything, run the function, then at the end, set the struct passed into the function back to what it was when it came in.

I'm testing a file system, and I have a file object struct that is used when opening/creating a file. One of my test cases involve trying to create a file in a nonexistent directory, and another is trying to create a file with the same name as a directory in the same directory, this both pass on fail of course, but apparently the test is corrupting my file object or something strange, and preventing further functions from running due to strange errors. I would like to try saving it as described above, but so far, setting it equal to doesn't work (working in Keil uVision 3 ANSI C).
¿why don't just pass the struct by copy?
Last edited on
Wasn't aware of a copy, I'm rather new to C and coding in general. So it's a function that will set all variables equal inside the struct?
Topic archived. No new replies allowed.