• 文件 转换 二进制


    将文件转换为二进制

    复制代码
    public byte[] getContent(string path)
            {
                
                System.IO.FileStream fs = new System.IO.FileStream(@path, System.IO.FileMode.Open);
                fs.Position = 0;
                byte[] content = new byte[fs.Length];
                fs.Read(content, 0, (int)fs.Length);
                fs.Close();
                return content;
            }
    复制代码

    将二进制转换为文件

    复制代码
            public void save(byte[] content,string path)
            {
                System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Create);
                System.IO.BinaryWriter bw = new System.IO.BinaryWriter(fs);
                bw.Write(content, 0, content.Length);
                bw.Close();
            }
    复制代码

    数据库存取的话 就是个普通的insert,select就可以了

  • 相关阅读:
    装配Bean
    百练
    东软小选拔
    俄罗斯乘法
    POJ
    ACdream
    javascript 链式作用域
    ie6/7 bug
    onreadystatechange 和 status
    瀑布流 <<转>>
  • 原文地址:https://www.cnblogs.com/zeroone/p/3192618.html
Copyright © 2020-2023  润新知