{
internal static class FileUtils
{
public static string GetRelativePath(string absPath, string baseDirectoryPath)
{
char[] array = new char[]
{
Path.DirectorySeparatorChar,
Path.AltDirectorySeparatorChar
};
baseDirectoryPath = Path.GetFullPath(baseDirectoryPath);
absPath = Path.GetFullPath(absPath);
baseDirectoryPath = baseDirectoryPath.TrimEnd(array);
string[] array2 = baseDirectoryPath.Split(array);
string[] array3 = absPath.Split(array);
int num = ;
while (num < Math.Min(array2.Length, array3.Length) && string.Compare(array3[num], array2[num], true) == )
{
num++;
}
if (num == )
{
return absPath;
}
string str = "";
for (int i = num; i < array2.Length; i++)
{
str = str + ".." + Path.DirectorySeparatorChar.ToString();
}
return str + string.Join(Path.DirectorySeparatorChar.ToString(), array3, num, array3.Length - num);
} public static void CopyStream(Stream input, Stream output)
{
byte[] array = new byte[];
int count;
while ((count = input.Read(array, , array.Length)) > )
{
output.Write(array, , count);
}
}
}
}

来自:https://github.com/FastReports/FastReport

[转][C#]文件流读取的更多相关文章

  1. Java实现http大文件流读取并批量插入数据库

    1.概述 请求远程大文本,使用流的方式进行返回.需要设置http链接的超时时间 循环插入到List中,使用mybatis-plus批量插入到mysql中 2.需求 两台服务器 大文件放到其中一台服务器 ...

  2. Delphi 用文件流读取文本文件字符串的方法

    procedure TForm23.Button4Click(Sender: TObject); var pstr:Pchar; mestr,Str1:string; FS:TFilestream; ...

  3. c的文件流读取

    strtok(数组,分隔符); atof(数组)返回值为转换后的数字; fgets(数组指针,长度,文件句柄); 整整花了两天啊

  4. FileStream文件流的读取和写入(为以后聊天工具的设计基础)

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Tex ...

  5. C# Path类 FileStream(文件流) 与 File(文件) 读取的区别

    1.采用文件流读取数据是一点一点从文件中读取数据对内存的压力相对较小;而采用文件读取数据是一下全部读取过来对内存造成的压力相对较大 2.File读取: string str = @"E:\Q ...

  6. C++基于文件流和armadillo读取mnist

    发现网上大把都是用python读取mnist的,用C++大都是用opencv读取的,但我不怎么用opencv,因此自己摸索了个使用文件流读取mnist的方法,armadillo仅作为储存矩阵的一种方式 ...

  7. excel to datatable (c#用NPOI将excel文件内容读取到datatable数据表中)

    将excel文件内容读取到datatable数据表中,支持97-2003和2007两种版本的excel 1.第一种是根据excel文件路径读取excel并返回datatable /// <sum ...

  8. c语言中的文件流

    一.打开和关闭文件 #include int main( void ) { FILE* pReadFile = fopen( "E:\\mytest.txt", "r&q ...

  9. 文件流StreamReader和StreamWriter的使用

    using (StreamReader sr = new StreamReader(@"C:\Users\shuai\Desktop\文件流读取.txt", Encoding.De ...

随机推荐

  1. Codeforces Round #349 (Div. 1)E. Forensic Examination

    题意:给一个初始串s,和m个模式串,q次查询每次问你第l到第r个模式串中包含\(s_l-s_r\)子串的最大数量是多少 题解:把初始串和模式串用分隔符间隔然后建sam,我们需要找到在sam中表示\(s ...

  2. 大家多开发点uwp吧

    未来一定是平板,笔记本合二为一的市场,微软的应用就是太少了.不过能通用的确实比较爽gest

  3. 快速高效实现微信小程序图片上传与腾讯免费5G存储空间的使用

    本文介绍了如何在微信小程序开发中使用腾讯官方提供的云开发功能快速实现图片的上传与存储,以及介绍云开发的 5G 存储空间的基本使用方法,这将大大提高微信小程序的开发效率 对于一般的图片上传功能开发,我们 ...

  4. AngularJS +Kendo UI Grid template

    var dataSource = new kendo.data.DataSource({ transport: { dataType: "json", read: inputUri ...

  5. day 01 python基础

    1.计算机历史 2.python历史 宏观: python2和python3的区别: python2  源码不标准,混乱,重复代码过多 python3  统一标准,去除重复代码 3.python环境 ...

  6. Android 关于arm64-v8a、armeabi-v7a、armeabi、x86下的so文件兼容问题

    Android 设备的CPU类型(通常称为”ABIs”) 引用: https://blog.csdn.net/ouyang_peng/article/details/51168072 armeabiv ...

  7. nodejs 安装失败 ,出现error 2502 和error2503

    出现error 2502 和error2503是因为win8的权限问题所导致的,具体说就是要以管理员身份进行安装就可以解决,下面详细来说一下. 1.cmd命令行点击以管理员身份运行. 2.这时候就可以 ...

  8. 移动rem自适应

    /** * rem计算方式:设计图尺寸px / 100 = 实际rem 例: 100px = 1rem */!function (window) { /* 设计图文档宽度 */ var docWidt ...

  9. jq demo 轮播图,图片可调用,向左,自动+鼠标点击切换

    <!doctype html> <html> <head> <meta http-equiv="Content-Type" content ...

  10. 指导手册05:MapReduce编程入门

    指导手册05:MapReduce编程入门   Part 1:使用Eclipse创建MapReduce工程 操作系统: Centos 6.8, hadoop 2.6.4 情景描述: 因为Hadoop本身 ...