Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

how to save the value in Cedit control into a text file bu using measurement studio c++?

Im using measurement studio c++ to create a application. How to save a randomly generated value which display in the CNumberEdit Control to a text file? how to do the coding part?
0 Kudos
Message 1 of 2
(3,140 Views)
You can use the CNiFile class to write the value out to a file. For example, create a new Measurement Studio C++ project and follow these steps:


  1. Add a CNiNumEdit to the dialog.


  2. Add a member variable for the CNiNumEdit called m_numEdit.


  3. Add a button to the dialog.


  4. Double-click the button to add a message handler for the button's BN_CLICKED message.


  5. Add the following code to the button's BN_CLICKED message handler:


    CNiFile file("C:\\Values.log", CFile::modeCreate | CFile::modeWrite | CFile::typeText);
    file << m_numEdit.Value << endl;
    file.Close();




  6. Run the application, edit the CNiNumEdit's value, and click the button. The value should be written to the Values.log
    file as specified in the code above.




Hope this helps.

- Elton
0 Kudos
Message 2 of 2
(3,140 Views)