This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Problem with List or END_OF_LIST
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 21, 2013
04:07 PM
Problem with List or END_OF_LIST
Hello All,
I'm having an issue with a list, or maybe end_of_list and i suspect it may be a bug, either that or i have to set some indexing or something... The code below is simply copying text from one file and writing it to another. However, it duplicates the last line. Any ideas? It's driving me mad and i'm about to log a bug with Flexera.
Please advise. TIA!
Here is the content of the file:
And it's duplicating the at the end of the file. Any ideas?
I'm having an issue with a list, or maybe end_of_list and i suspect it may be a bug, either that or i have to set some indexing or something... The code below is simply copying text from one file and writing it to another. However, it duplicates the last line. Any ideas? It's driving me mad and i'm about to log a bug with Flexera.
Please advise. TIA!
OpenFileMode (FILE_MODE_NORMAL);
if (OpenFile(nvFileHandleSource, sSourcePath, sSourceFile) < 0) then
else
//Create list of strings from file.
FileList = ListCreate(STRINGLIST);
while (GetLine (nvFileHandleSource, svLineSource) = 0)
ListAddString (FileList, svLineSource, AFTER);
endwhile;
endif;
//Open source file for setting strings.
OpenFileMode (FILE_MODE_APPEND);
if (OpenFile(nvFileHandleDest, sDestPath, "\\DeviceLink.xml") < 0) then
MessageBox ("3 Opening of: DeviceLink.xml failed. Manual xml file configuration required.", WARNING);
else
nResult = ListGetFirstString(FileList, szFirstLineDest);
WriteLine(nvFileHandleDest, szFirstLineDest);
while (nResult != END_OF_LIST)
nResult = ListGetNextString (FileList, svLineDest);
WriteLine(nvFileHandleDest, svLineDest);
endwhile;
endif;
ListDestroy (FileList);
Here is the content of the file:
false
false
5
Datascope.DatascopeDevice
Datascope
And it's duplicating the at the end of the file. Any ideas?
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 21, 2013
04:38 PM
If you display the list populated from the source file with SdShowInfoList, is the list correct at that point? (There's also ListReadFromFile, which could simplify that part.)
In the second part, if you display each string before calling WriteFile, does the last line get displayed twice?
Probably doesn't have a bearing on the issue, but you might call CloseFile when you're done reading and writing each file.
In the second part, if you display each string before calling WriteFile, does the last line get displayed twice?
Probably doesn't have a bearing on the issue, but you might call CloseFile when you're done reading and writing each file.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 21, 2013
09:47 PM
Hello Robert,
Thank you for replying. I can always count on you. I have had a chance to try the sd.... but i can say that when i put a messagebox in the while statement, it does display the item twice.
I'll try what you suggested here, but i suspect it's not going to make a difference. I wonder if there is some escape sequence in somehow? I just can't put my finger on it. I'll give it a shot tomorrow morning and see what happens.
Thank you for replying. I can always count on you. I have had a chance to try the sd.... but i can say that when i put a messagebox in the while statement, it does display the item twice.
I'll try what you suggested here, but i suspect it's not going to make a difference. I wonder if there is some escape sequence in somehow? I just can't put my finger on it. I'll give it a shot tomorrow morning and see what happens.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 22, 2013
09:22 AM
So i tried ListReadFromFile and ListWritetoFile it doesn't duplicate that end tag. But, it also does use the FILE_MODE_APPEND either, so i get a file with just the text i wrote, it overwrites everything else in the file.
This repeating of the last string in the list is certainly a bug. Is there a place i can log the bug?
This repeating of the last string in the list is certainly a bug. Is there a place i can log the bug?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 22, 2013
10:10 AM
Would still like to report that bug, but....
I found a workaround to the writing extra last line and append issue. Use ListWriteToFileEX instead:
ListWriteToFileEx(FileList, sDestPath + "\\DeviceLink.xml", LWTF_OPTION_APPEND_TO_FILE);
I found a workaround to the writing extra last line and append issue. Use ListWriteToFileEX instead:
ListWriteToFileEx(FileList, sDestPath + "\\DeviceLink.xml", LWTF_OPTION_APPEND_TO_FILE);
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 22, 2013
10:11 AM
I haven't had a chance to run a test, but what happens if you swap the order of these two lines inside the while loop?
In the current order, ListGetNextString will return END_OF_LIST, but WriteLine will be called again with the last value of svLineDest.
P.S. Good find about ListWriteToFileEx. I'd forgotten that existed!
nResult = ListGetNextString (FileList, svLineDest);
WriteLine(nvFileHandleDest, svLineDest);
In the current order, ListGetNextString will return END_OF_LIST, but WriteLine will be called again with the last value of svLineDest.
P.S. Good find about ListWriteToFileEx. I'd forgotten that existed!