LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a new file without using the file select pop up in CVI

I need to find a function for CVI that automatically creates a new file that i can write to. I will not be able to select a file when i am running the application, so i need to set up the program so that he application is automatically created.
0 Kudos
Message 1 of 4
(3,650 Views)
Hi,

FileSelectPopup() function does not creates the file, it is just a way to have the user select a path. If you don;t need the user to select a path just call OpenFile(,,,) and pass the path that you create. After the open you can use ReadFile or WriteFile functions to read the file as usual.

You may need the Fmt(,,) functio to create the path at run time, you can create a string and append the file extension and them pass that as the path.

Let me know if you have any questions.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 2 of 4
(3,652 Views)
hi,
the open/create file vi accepts file name and path type and not a string,
i want to assign file name through a program,
please tell me how to do it,
if you can attach an example it will be halpful
thank you
akash

0 Kudos
Message 3 of 4
(3,495 Views)

In case you need to build a complex pathname and don't want problems in formatting backslashes or so, you can recursively use MakePathname function to create your file/path name: this example creates the variable <file> that holds the pathname for C:\TEMP\TEST.TXT file.

char file[MAX_PATHNAME_LEN];
MakePathname ("c:", "temp", file);
MakePathname (file, "test.txt", file);



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 4 of 4
(3,475 Views)