FileStream.Name 속성

정의

FileStream에서 열린 파일의 절대 경로를 가져옵니다.

public:
 property System::String ^ Name { System::String ^ get(); };
public:
 virtual property System::String ^ Name { System::String ^ get(); };
public string Name { get; }
public virtual string Name { get; }
member this.Name : string
Public ReadOnly Property Name As String
Public Overridable ReadOnly Property Name As String

속성 값

String

파일의 절대 경로인 문자열입니다.

예제

이 코드 예제는에 대해 제공 된 큰 예제의 일부는 FileStream(String, FileMode, FileAccess, FileShare, Int32, Boolean) 생성자입니다.

   static void EndReadCallback( IAsyncResult^ asyncResult )
   {
      State^ tempState = dynamic_cast<State^>(asyncResult->AsyncState);
      int readCount = tempState->FStream->EndRead( asyncResult );
      int i = 0;
      while ( i < readCount )
      {
         if ( tempState->ReadArray[ i ] != tempState->WriteArray[ i++ ] )
         {
            Console::WriteLine( "Error writing data." );
            tempState->FStream->Close();
            return;
         }
      }

      Console::WriteLine( "The data was written to {0} "
      "and verified.", tempState->FStream->Name );
      tempState->FStream->Close();
      
      // Signal the main thread that the verification is finished.
      tempState->ManualEvent->Set();
   }


public:
static void EndReadCallback(IAsyncResult asyncResult)
{
    State tempState = (State)asyncResult.AsyncState;
    int readCount = tempState.FStream.EndRead(asyncResult);

    int i = 0;
    while(i < readCount)
    {
        if(tempState.ReadArray[i] != tempState.WriteArray[i++])
        {
            Console.WriteLine("Error writing data.");
            tempState.FStream.Close();
            return;
        }
    }
    Console.WriteLine("The data was written to {0} and verified.",
        tempState.FStream.Name);
    tempState.FStream.Close();

    // Signal the main thread that the verification is finished.
    tempState.ManualEvent.Set();
}
Private Shared Sub EndReadCallback(asyncResult As IAsyncResult)
     Dim tempState As State = _
         DirectCast(asyncResult.AsyncState, State)
     Dim readCount As Integer = _
         tempState.FStream.EndRead(asyncResult)

     Dim i As Integer = 0
     While(i < readCount)
         If(tempState.ReadArray(i) <> tempState.WriteArray(i))
             Console.WriteLine("Error writing data.")
             tempState.FStream.Close()
             Return
         End If
         i += 1
     End While

     Console.WriteLine("The data was written to {0} and " & _
         "verified.", tempState.FStream.Name)
     tempState.FStream.Close()

     ' Signal the main thread that the verification is finished.
     tempState.ManualEvent.Set()
 End Sub

설명

절대 경로를 알 수 없는 경우 이 속성은 "[Unknown]"에 유사한 문자열을 반환합니다.

일반적인 파일 및 디렉터리 작업 목록은 일반적인 I/O 작업을 참조하세요.

적용 대상

추가 정보