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

質問編集履歴

3

間違っていたところを修正してアップしていた

2018/06/26 02:04

投稿

shimazu
shimazu

スコア38

title CHANGED
File without changes
body CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  public class TestScript : MonoBehaviour {
15
15
  void Start(){
16
- string path = "/Users/xxxxxxxxxxxxxx/TestPOSTAPI/Assets/Resources/dummy01.png";
16
+ string path = "file:/Users/xxxxxxxxxxxxxx/TestPOSTAPI/Assets/Resources/dummy01.png";
17
17
  byte[] body = readPngFile(path);
18
18
  }
19
19
 

2

MacなのでC不要

2018/06/26 02:04

投稿

shimazu
shimazu

スコア38

title CHANGED
File without changes
body CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  public class TestScript : MonoBehaviour {
15
15
  void Start(){
16
- string path = "C:/Users/xxxxxxxxxxxxxx/TestPOSTAPI/Assets/Resources/dummy01.png";
16
+ string path = "/Users/xxxxxxxxxxxxxx/TestPOSTAPI/Assets/Resources/dummy01.png";
17
17
  byte[] body = readPngFile(path);
18
18
  }
19
19
 

1

コードの修正

2018/06/26 01:56

投稿

shimazu
shimazu

スコア38

title CHANGED
File without changes
body CHANGED
@@ -8,14 +8,15 @@
8
8
 
9
9
  ```csharp
10
10
 
11
- using System;
11
+ using UnityEngine;
12
12
  using System.IO;
13
- using System.Text;
14
- using System.Collections;
15
- using System.Collections.Generic;
16
- using UnityEngine;
17
- using UnityEngine.Networking;
18
13
 
14
+ public class TestScript : MonoBehaviour {
15
+ void Start(){
16
+ string path = "C:/Users/xxxxxxxxxxxxxx/TestPOSTAPI/Assets/Resources/dummy01.png";
17
+ byte[] body = readPngFile(path);
18
+ }
19
+
19
20
  byte[] readPngFile(string path) {
20
21
  using (FileStream fileStream = new FileStream (path, FileMode.Open, FileAccess.Read)) {
21
22
  BinaryReader bin = new BinaryReader (fileStream);
@@ -23,8 +24,8 @@
23
24
  bin.Close ();
24
25
  return values;
25
26
  }
26
- }
27
+ }
27
-
28
+ }
28
29
  ```
29
30
 
30
31
  絶対パスにする方法として@をつければ出来るものもあったので、試しましたが同様のエラーでした。