teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

ファイル読み込みの変更

2016/09/05 12:45

投稿

sobue
sobue

スコア331

title CHANGED
File without changes
body CHANGED
@@ -8,10 +8,10 @@
8
8
 
9
9
  ###該当のソースコード
10
10
  ```C#
11
- String fname = System.IO.Path.Combine(new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).Directory.FullName, "test.csv");
11
+ String f = System.Windows.Forms.Application.StartupPath+"\\test.csv";
12
12
 
13
13
  // csvファイルを開く
14
- using (System.IO.StreamReader sr = new System.IO.StreamReader(fname, System.Text.Encoding.GetEncoding("shift_jis")))
14
+ using (System.IO.StreamReader sr = new System.IO.StreamReader(f, System.Text.Encoding.GetEncoding("shift_jis")))
15
15
  {
16
16
  // ストリームの末尾まで繰り返す
17
17
  while (!sr.EndOfStream)

1

読み込み情報の変更

2016/09/05 12:45

投稿

sobue
sobue

スコア331

title CHANGED
File without changes
body CHANGED
@@ -8,8 +8,10 @@
8
8
 
9
9
  ###該当のソースコード
10
10
  ```C#
11
+ String fname = System.IO.Path.Combine(new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).Directory.FullName, "test.csv");
12
+
11
- // csvファイルを開く
13
+ // csvファイルを開く
12
- using (System.IO.StreamReader sr = new System.IO.StreamReader(@"test.csv", System.Text.Encoding.GetEncoding("shift_jis")))
14
+ using (System.IO.StreamReader sr = new System.IO.StreamReader(fname, System.Text.Encoding.GetEncoding("shift_jis")))
13
15
  {
14
16
  // ストリームの末尾まで繰り返す
15
17
  while (!sr.EndOfStream)