LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How save text file using relative project path

Hi there,

 

I am trying to create an application which uses my project's relative folder path in order to save an text file into the same folder (so that I do not have to rewrite the build path when I run my application on another computer, for instance). I've made some research, but I could not find anything that would solve this issue.

 

How should I do this properly?

0 Kudos
Message 1 of 3
(3,209 Views)

Hello,

 

Looks like GetProjectDir is what you are looking for. The documentatin link also explains how you can use this function.

 

Constantin

0 Kudos
Message 2 of 3
(3,201 Views)

Be careful if your app will be in a "Program Files" directory on the target machine, which is different from debugging in the IDE. Your app may not be allowed to write to that folder, although Windows may silently redirect the write to another folder. More info on that here

 

Since you asked how to do it "properly" you should consider getting the "AppData" folder and writing your files into your own folder there. My questions on doing that properky that were answered in this thread.

 

Good luck!

0 Kudos
Message 3 of 3
(3,194 Views)