LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

open ini file

Solved!
Go to solution

hello,

 

i have a little problem ans hope everyone can help me.

I would like to open a *.ini file if I press the button, but the file does not open. can somebody please help me?

 


int CVICALLBACK LoadFile(int panel, int control, int event,   void *callbackData, int eventData1, int eventData2)
{
         switch (event)
        {
              case EVENT_COMMIT:
                   OpenFile("c:\\home\\My Documents\\studium\\File.ini",VAL_READ_WRITE,VAL_OPEN_AS_IS,VAL_ASCII);
                   break;
        }
        return 0;
}

0 Kudos
Message 1 of 4
(3,767 Views)
Solution
Accepted by topic author Axinia

i am not sure, what do you expect the OpenFile() function to do ?

 

OpenFile() opens the file in a programmatic manner: it means that it makes available a value (that you should store in a variable) which allows you to read or write data to/from the file bycalling file manipulation functions like ReadFile() or WriteFile(). it will NOT open the file in your favourite editor !

 

to open the file in the Windows user Interface meaning of the word, use the function OpenDocumentInDefaultViewer().

0 Kudos
Message 2 of 4
(3,753 Views)

Hi Axinia,

 

What do you actually want to do when the button is clicked?

Do you want to open a seperate text viewer (like notepad) to see the contents of the file or do you want to read the contents of the file into a string?

 

The solution depends on your answer.

 

The code you have provided actually opens a file to be read/written, but you have to assign the return value to a variable in order to access it later.

 

int fileHandle;
fileHandle = OpenFile (...); 

 

Hope this helps, 

S. Eren BALCI
IMESTEK
0 Kudos
Message 3 of 4
(3,752 Views)

thx dummy_decoy

exactly this I have looked 🙂

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