LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

File Error

If I write fopen ( testsauvegarde, "r+' );

labwindows CVI don't understand what is the file.

 
0 Kudos
Message 11 of 19
(1,972 Views)

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?

 

 

0 Kudos
Message 12 of 19
(1,969 Views)

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

0 Kudos
Message 13 of 19
(1,966 Views)

OK, I give up... Smiley Frustrated

 

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?

 

Message 14 of 19
(1,963 Views)

I tried all of things that you advised to me and I thank you

0 Kudos
Message 15 of 19
(1,961 Views)

@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

0 Kudos
Message 16 of 19
(1,956 Views)

I tried

char testsauvegarde [ MAX_PATHNAME_LEN ]

0 Kudos
Message 17 of 19
(1,953 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 18 of 19
(1,952 Views)

Thank you for your answer Roberto. I try to understand all of this shades.

 

Anaël.

0 Kudos
Message 19 of 19
(1,934 Views)