How Can I Save and Change a String
- ergun
- Posts: 2
- Joined: Tue May 03, 2011 7:43 am
How Can I Save and Change a String
I want to save and change a string. I will entry a string from keyboard and i want to save that string to eeprom. Also i want to change last saved string how can i do this could me help please .
- stalley
- Enovation Controls Development
- Posts: 618
- Joined: Tue Mar 18, 2014 12:57 pm
Re: How Can I Save and Change a String
Hi Ergun,
Thank you for your question! The answer requires some scripting to accomplish what you want to do. This is a very simple example, I'm sure you will have something with more logic, but hopefully this will give you an idea of what you will need to do.
First I created a String Variable, NameString.
On start up, I have the following code executing:
When I want to save the NameString variable:
When you edit a script, there are tabs for Function Reference and Scripting Syntax Reference. These are helpful and provide more information about the valid parameters to the functions and what functions are available!
Thank you for your question! The answer requires some scripting to accomplish what you want to do. This is a very simple example, I'm sure you will have something with more logic, but hopefully this will give you an idea of what you will need to do.
First I created a String Variable, NameString.
On start up, I have the following code executing:
Code: Select all
void $InitializeString$ ()
{
file f;
string str = "";
int fStatus;
int fSize = 0;
if (f.open( "stringToSave.txt", "r" ) >= 0 )
{
fSize = f.getSize();
if (fSize > 0)
fStatus = f.readString(fSize, str);
}
f.close();
smWrite(VariableIDs.fileStatus, fStatus);
if (str != "")
{
cultureSetString(StringIDs.NameString, str, true);
}
}
Code: Select all
{
file f;
string str;
if (f.open( "stringToSave.txt", "w" ) >= 0 )
{
cultureGetString(StringIDs.NameString, str, 0);
f.writeString(str);
}
f.close();
}
Sara Talley
Software Engineer
Enovation Controls
Software Engineer
Enovation Controls
- bburgess
- Posts: 2
- Joined: Thu Oct 06, 2011 3:06 pm
Re: How Can I Save and Change a String
Saving keybord generated STRING: Do you have a simplified means to save to PV450' 780 NV memory?


- jpratt
- Enovation Controls Development
- Posts: 222
- Joined: Mon Jun 21, 2010 11:18 am
Re: How Can I Save and Change a String
The example above shows the current easiest way to save and restore a string from the flash (NV). We will add support for using actions to save strings in a future versions.
Jake Pratt
Software Development Manager
Software Development Manager