[Script, C#] TextFile Read ProjectA

//TextReader.cs by DAKDAE

using UnityEngine;
using System;
using System.Collections;
using System.IO;

public class TextReader : MonoBehaviour
{
public string TextRead(string fileName)
{
string path;
string resultText;
StreamReader sr;
path = Application.dataPath;
     if(!File.Exists(path + fileName))
     {
     Debug.Log("no Exist File");
     return null;
     }
    
     Debug.Log("File Exist");
    
sr = new StreamReader(path + fileName, System.Text.Encoding.Default);
  if(sr == null)
  {
  Debug.Log("File Load Fail");
  return null;
  }
 
  Debug.Log("File Load Success");
 
  resultText = sr.ReadToEnd();
 
  sr.Close();
 
  return resultText;
}
public void Close() {this.Close();}
}


트랙백

이 글과 관련된 글 쓰기 (트랙백 보내기)
TrackbackURL : http://dakdae.egloos.com/tb/684360 [도움말]

덧글

댓글 입력 영역