06-21-2016 06:04 AM
If I write fopen ( testsauvegarde, "r+' );
labwindows CVI don't understand what is the file.
06-21-2016 06:16 AM
How did you declare testsauvegarde? Do you have a line such as
char testsauvegarde [ MAX_PATHNAME_LEN ];
Did you read the description of the function MakePathname ? And did you put a breakpoint in your code to have a look at the contents of your variables?
06-21-2016 06:54 AM
I declared testsauvegarde like this:
FILE* testsauvegarde = NULL;
Yes, I red the description but maybe I didn't understand everything... I should do breakpoints but when I run the program it stops at fopen so I think everything before this instruction is good
06-21-2016 07:01 AM
OK, I give up...
I tried to explain what you should do, in my point of view, to get your code working.
There is a working example in the help of MakePathname, the code I posted is working as well, but if you prefer to do it differently what can I do?
06-21-2016 07:09 AM
I tried all of things that you advised to me and I thank you
06-21-2016 07:20 AM
@Anaël wrote:I tried all of things that you advised to me...
NO.
I suggested
char testsauvegarde [ MAX_PATHNAME_LEN ] = "";
whereas you have
FILE* testsauvegarde = NULL;
This is not the same... FILE is a structure, not a simple char array
06-21-2016 07:25 AM
I tried
char testsauvegarde [ MAX_PATHNAME_LEN ]
06-21-2016 07:25 AM - edited 06-21-2016 07:27 AM
Anael,
you should understand the difference between the file name (or pathname, which is similar; type char *) which is passed to fopen (), and the file handle which is returned from the function and is to be used in subsequent functions to access the file (type FILE *). Besides the suggestions from Wolfgang, in the help for fopen function there are 2 examples linked that you should loook at to understand how the function works.
If I may add, calling a variable with the same exact name of an actual file in this case is misleading: call the variable e.g. 'pathname', fill it with your file name using one of the method Wolfgang suggested and use it in the call to fopen.
Finally, can you post the complete code you are using? I mean, variable declaration and function calls so that we can understand what's going on.
06-22-2016 01:44 AM - edited 06-22-2016 01:45 AM
Thank you for your answer Roberto. I try to understand all of this shades.
Anaël.