I am working on a program that creates a variable containing text. The text has many characters, a few spaces, etc, etc. When i output the variable to an Executable that is suppose to take the variable and output it to a text file, it stops at the spaces. At first i thought it might be recognising the spaces as different parameters, givining it too man. here's an examples of the code:

variable:

savefile=
defaultframe=main&
&menu1=Home;../home.htm;main&
&menu2=Need help$$$$$$$$$$$$$$$$$&
&menu3=sdfsdf$$$$$$$$$$$$$$$$$&
&menu4=sdfsdf$$$$$$$$$$$$$$$$$&

then the FScommand to output it to the Exec is

FSCommand("exec", "savetxt.exe" add chr(9) add savefile)

this then outputs a text file that displays:

defaultframe=main&
&menu1=Home;../home.htm;main&
&menu2=Need

... and it stops there. when i hard code it in, like so:

c:\directory\>savetxt.exe Welcome to my txt file! <enter>

it outputs to the text file perfectly:

Welcome to my txt file!

it seems as though in the variables send from Flash, " " characters dont want to recognise as spaces! You have to actually type in "word" add chr(9) add "anotherword" to get a space between two words.

so.... ive run into a big problem.... solutions??

some of what ive thought of.
a) Trying to find a way to do a search and replace in the variable, meaning finding all the space characters, adding some other character/symbol to it, then letting the Exec decode it as spaces.
*only problem with this is that i dont know how to do a search and replace command in Actionscript. ??

b) Learn some new method of running the EXE and sending the variable in a proper format? <this is more of a "clasp your hands and pray" type solution>

and yah... im clueless. if you can help, gimme a shout! it would be well appreciated