2012-11-29 1 views
1

C++ ostream :: tellp의 StreamWriter에 해당하는 C#이 있습니까? 나는 오래된 C++ 코드를 C#으로 이식하고 있지만 클라이언트는 여전히 디스켓 (읽기 : 구형 장비)을 계속 사용하기를 원하므로 파일 포인터 위치를 찾거나 내가 얼마나 많이 작성했는지 찾을 방법을 찾아야한다. 디스크가 이미 있습니다. 참조 MSDNC#에 해당하는 C++ ostream :: tellp 디스켓의 크기 제한

private bool isDisketteBoundary(ref StreamWriter swOutput, int nCurrentDisketteNo) { 
     // Get current file pointer position 
     // long filePosition = nOStream.tellp(); <-- C++ code 
     long filePosition = 0; // <-- needs to change to find file pointer position 

     // Valid? 
     if(filePosition != -1) { 
      // Is the new size over a boundary? 
      float numDiskettes = (float)((float)filePosition/(float)Constants.DisketteSize); 
      int disketteCount = Convert.ToInt32(Math.Ceiling(numDiskettes)); 

      // Is the diskette count larger than the current index? 
      return (nCurrentDisketteNo < disketteCount) ? true : false; 
     } 
     else { 
      throw new Exception("Unable to get file pointer from StreamWriter"); 
     } 
} 
+0

그런 다음 클라이언트를 업그레이드하십시오! ;-) – Kos

+0

@Kos 그들이 회사에 지불하는 금액에서, 나는 그것이 나쁜 생각일지도 모른다라고 생각한다. : P –

+0

실제 이름은 "플로피 디스크"=) – Calvin1602

답변