zoukankan      html  css  js  c++  java
  • paip.erlang 文本文件读写操作attilax总结

    paip.erlang 文本文件读写操作attilax总结


    作者Attilax ,  EMAIL:1466519819@qq.com 
    来源:attilax的专栏
    地址:http://blog.csdn.net/attilax


    ///halo.erl


    main(_) -> 
        io:format("Hello worldnx"),
        {ok, S} = file:open("test2.dat", write),
    io:format(S, "~s~n", ["Hello readers"]),
    io:format(S, "~w~n", [123]).


    /运行
    "D:\Program Files\erl5.10.3\bin\escript.exe"  "D:\Program Files\erl5.10.3\halo.erl"


    /结果
    C:\Documents and Settings\Administrator\test2.dat 文件内容
    Hello readers
    123








    说明
    其中的~开头的字符是一个个格式化命令,比如常见的:
    ~c   anscii码
    ~f   浮点数
    ~s   字符串
    ~w   Erlang term
    ~p   与~w类似,不过当多行时将自动换行
    ~n   显然,换行符

  • 相关阅读:
    Selenium库的使用
    Win10 常用快捷键
    503.下一个更大元素 II
    456.132模式
    201.数字范围按位与
    78.子集
    299.猜数字游戏
    49.字母异位词分组
    36.有效的数独
    290.单词规律
  • 原文地址:https://www.cnblogs.com/attilax/p/15199471.html
Copyright © 2011-2022 走看看