[erlang-questions] Problem with io:fwrite/2 ?

Robert Virding rvirding@REDACTED
Fri May 28 13:56:55 CEST 2010


Some points here:

- There is no difference at all between io:fwrite and io:format.
Format is the older name, but I added the name fwrite to match fread.

- In both cases format/2 and fwrite/2 the arguments are fwrite(Format,
Data), if you want to send it to a specific iodevice then you need to
use the 3 argument calls. The different versions are:

fwrite(Format)          %Format must not need data
fwrite(Format, Data)
fwrite(IoDevice, Format, Data)

Same for format of course.

Robert

On 27 May 2010 19:01, Gardell, Steven <sgardell@REDACTED> wrote:
> Running R13B04 under Linux RES 4.
> It seems that io:fwrite/2 is hanging "most of the time." With the
> following code segment:
>
>  io:format("BEFORE FULL WRITE~n"),
>    io:fwrite(CL#'CallLog'.file,
>        "Calls: ~w Rate: ~w Trans: ~w %SlowAdd: ~.1f %SlowMod: ~.1f
> %SlowOther ~.1f %SlowTotal ~.1f %Slow2: ~.1f %Slow3: ~.1f Failed ~w
> Unexpected: ~w~n",
>        [CL#'CallLog'.callCount,
>        Rate,
>        CL#'CallLog'.transCount,
>        SlowAdd1,
>        SlowMod1,
>        SlowOther1,
>        SlowTotal1,
>        SlowTotal2,
>        SlowTotal3,
>        CL#'CallLog'.failedCount,
>        CL#'CallLog'.unexpectedMsg]),
>
>    io:format("BEFORE EMPTY LINE~n"),
>    io:fwrite(CL#'CallLog'.file,"~n"),
>    io:format("AFTER EMPTY LINE~n").
>
> I see:
>
> 1> LOADTEST: Ready
> loadtest:onecall(twoterm4trans).
> Test: 5/27/2010 12:47:36 Rate: 1 Hold: 1 Calls:1
> {go,1,1,0,1,1,twoterm4trans}
> BEFORE FULL WRITE
> BEFORE EMPTY LINE
> 2>
>
> The subsequent behavior of the program leads me to believe
> we never returned from fwrite().
>


More information about the erlang-questions mailing list