Old 17th September 2009, 14:01   #1
webtubbies
Junior Member
 
Join Date: Sep 2009
Posts: 17
loop problem.

Hi all,

I'va got a problem on a loop. the subject is to read lines of a text file A and write these lines in an xml file.

the FileRead Function reads all the lines (confirmed by DetailPrint). I think the line are written in the xml.
But the result is: my XML file only contains
PHP Code:
<Main></Main
If somone have an idea...

Here's my code:
PHP Code:
ClearErrors
    FileOpen 
$4 $InfoPDVTxt r
    FileOpen 
$0 $InfoPDVTemp a
    
;FileSeek $0 0 END    
    FileWrite 
$"<Main>$\r$\n"
    
FileSeek $0 0 END
    
    loop
:
        
FileRead $$1
        DetailPrint 
"$1"
        
IfErrors done
        FileSeek 
$0 0 END
        FileWrite 
$"$1"
        
Goto loop
    
    done
:
        
FileWrite $"</Main>$\r$\n"
        
Close the files
        FileClose 
$0
        FileClose 
$
webtubbies is offline   Reply With Quote
Old 17th September 2009, 14:10   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
When I replace $InfoPDVTxt and $InfoPDVTemp with actual filenames, your code works just fine here. The problem must be elsewhere in your code.

Unrelated: I think you don't need the FileSeek $0 0 END lines.
MSG is offline   Reply With Quote
Old 17th September 2009, 14:16   #3
webtubbies
Junior Member
 
Join Date: Sep 2009
Posts: 17
You are right. Sorry for that.
And thank you for the advice about FileSeek.

So i'm on my way to find the problem.
webtubbies is offline   Reply With Quote
Old 18th September 2009, 12:21   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Use w not a for the write mode and put another ClearErrors before loop:.

That should narrow down some more.

Stu
Afrow UK is offline   Reply With Quote
Old 18th September 2009, 14:39   #5
webtubbies
Junior Member
 
Join Date: Sep 2009
Posts: 17
Ok,
That 's what I did juste before your answer. thank you
webtubbies is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump