Saving TextOutputStream to known location

On my desktop, there is a folder named MapA.
In this folder, there is a subfolder named MapB.
In this subfolder, MapB, I want to save a TextOutputStream.
How can I do this without using a save dialogbox ?

Thanks

[code]Dim f As FolderItem

f = SpecialFolder.Desktop.child(“MapA”).child(“MapB”)[/code]
However, when I code something like this I always do it in individual parts so that I can verify everything works properly at each level of the file hierarchy and issue to the proper messages if it doesn’t.

I should have said that will get you to the folder MapB. You will need more code to point to the desired file within that folder.

Thanks Harrie, I try it out.

Here is the code I tried out, but I get a IOException Error on the line mared with <===========================

Sub MaakCSV(TableName As String, Row As Integer)

Dim RS As RecordSet, SQLTekst As string
SQLTekst = "SELECT * FROM " + TableName
RS = GardenasWeb.SQLSelect(SQLTekst)

TableName = TableName + “.csv”

Dim f As FolderItem
Dim tos As TextOutputStream
Dim s As String
Dim I As Integer

f = SpecialFolder.Desktop.Child(“MapA”).Child(“MapB”)
If f <> Nil Then
tos = TextOutputStream.Create(f) <===========================
s = “”
For I = 0 to RS.FieldCount - 1
s = s + RS.IdxField(i+1).Name + “;”
Next I
tos.WriteLine s.Left(s.Len-1)
RS.MoveFirst
While Not RS.EOF
s = “”
For I = 0 to RS.FieldCount - 1
s = s + RS.IdxField(i+1).StringValue + “;”
Next
tos.WriteLine s.Left(s.Len-1)
RS.MoveNext
Wend
tos.Close
End If

End Sub

Where is the error cause ?

Remark :
Now I see that I forgot something !
Where do I mention the name of the file “Tablename” in the code ?

[quote=175185:@Antoon Verleysen]f = SpecialFolder.Desktop.Child(“MapA”).Child(“MapB”)
If f <> Nil Then
tos = TextOutputStream.Create(f) <===========================[/quote]
TextOutputStream.Create needs a FolderItem to the text file to create. You’ve only provided a path to a folder. Something like this will point to a file within the folder to create:

f = SpecialFolder.Desktop.Child("MapA").Child("MapB").Child(TableName)

Thanks Harrie and Paul.
The code from Paul works.
My problem has been solved !!!