New topic in Getting Started: 

Problem with TextOutputStream

frankvanolffen - Sat Mar 29, 2008 1:16 am

<http://forums.realsoftware.com/viewtopic.php?t=21505>
                                                                                
                                                                                
Hi,

My code does not work and I do not know why.

What is wrong with this ?????
It's not writing a file after i do close it with stream2.close

But there is a file while I run the code but when I close the program all is 
gone

Code:
Dim basis,doel As FolderItem
Dim welniet, txt As string
Dim vandaag As  new Date
dim Stream2 As TextOutputStream
basis=GetFolderItem(" ").Parent
doel=basis.child("Medewerkers").Child((str(vandaag.year))).child("Oude 
medewerkers.txt")
if doel <> Nil and doel.Exists then
  i=val(volgorde.text)
  if lhkorting(i)= True then
    welniet=" wel "
  else
    welniet=" geen "
  end if
  MsgBox"er is een file"
  stream2=doel.AppendToTextFile
  txt="Naam van Medewerker            :"+Naam(i)
  stream2.writeline txt
  txt="Geboorte datum                       :"+str(Gebdag(i))+" 
"+str(Gebmaand(i))+" "+str(Gebjaar(i))
  stream2.writeline txt
  txt="Sofinummer                              :"+sofi(i)
  stream2.writeline txt
  txt= "Totaal is er                                
 :"+str(tverdiend(i))+" Euro verdiend"
  stream2.writeline txt
  txt="Hij heeft"+welniet+"gebruik gemaakt van de loonheffings korting"
  stream2.writeline txt
  
txt="=========================================================================="
  stream2.writeline txt
  stream2.close
else
  i=val(volgorde.text)
  if lhkorting(i)= True then
    welniet=" wel "
  else
    welniet=" geen "
  end if
  MsgBox"er is ggeeen file"
  stream2=doel.CreateTextFile
  txt="Naam van Medewerker            :"+Naam(i)
  stream2.writeline txt
  txt="Geboorte datum                       :"+str(Gebdag(i))+" 
"+str(Gebmaand(i))+" "+str(Gebjaar(i))
  stream2.writeline txt
  txt="Sofinummer                              :"+sofi(i)
  stream2.writeline txt
  txt= "Totaal is er                                
 :"+str(tverdiend(i))+" Euro verdiend"
  stream2.writeline txt
  txt="Hij heeft"+welniet+"gebruik gemaakt van de loonheffings korting"
  stream2.writeline txt
  
txt="=========================================================================="
  stream2.writeline txt
  stream2.close
  



Frank                                   
                                                                                
                                                                                
                                                                                
                                                                                
                                        



-- 
Over 900 classes with 18000 functions in one REALbasic plug-in. 
The Monkeybread Software Realbasic Plugin v8.1. 

&lt;http://www.monkeybreadsoftware.de/realbasic/plugins.shtml&gt;

[email protected]

Reply via email to