<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR></HEAD>
<BODY>
<DIV class=gmail_quote>I don't understand. After the reception of the filename
the variable S is defined ! </DIV>
<DIV class=gmail_quote>I could understand a run-time error if I send a message
before to send the filename !!</DIV>
<DIV class=gmail_quote> </DIV>
<DIV class=gmail_quote>2009/4/2 Gamoto <SPAN
dir=ltr><gamoto@bluewin.ch></SPAN><BR></DIV>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">What
is wrong in this function ? I receive the following error: variable 'S' is
unbound !<BR>I also receive two warnings: File is unused, S is unused.<BR>This
process can receive two messages: one file to open and one message to
write<BR><BR>Pid ! {open,"filetoopen.txt"}<BR><BR>Pid ! {data,
Message}<BR><BR>log_message()-><BR> receive<BR>
{open,File} -> case
file:open("File", [append]) of<BR>
{ok,S} -> log_message();<BR>
{error,Reason} -> io:format( "~s~n",[Reason])<BR>
end;<BR>
{data,Data} ->
io:format(S,"~s~n",[Data]),<BR>
log_message()<BR>
end.</BLOCKQUOTE>
<DIV class=gmail_quote><BR>- The variable File is defined in the message
{file,File} you recieve but is never used, you open the file "File".<BR><BR>-
The variable S is defined when you receive the {open,File} message, but you wish
to use it when you receive the {data,Data} message where it is not
defined.<BR><BR>Robert<BR><BR></DIV></BODY></HTML>