Einzelnen Beitrag anzeigen

simjoh

Registriert seit: 13. Nov 2006
Ort: Asslar
99 Beiträge
 
Delphi 7 Enterprise
 
#24

Re: Hilfe beim Übersetzten von C in Delphi

  Alt 23. Mär 2007, 14:59
Die gesamte Funktion sieht so aus:

Delphi-Quellcode:
   bool WriteHandHistoryLog(const char* TableName,const char* HandNumber,
      const char* Buffer,const unsigned int BufferLen)
   {   // This function writes the Buffer out to the given logfile.
      // It writes in binary mode exactly BufferLen bytes.
      // NOTE: If HandNumber is NULL, then we wont print the hand start prefix.
      // Returns true on success, else false.

      // Used to make the full filename.
      char NewName[MAX_STRING];

      // Output filestream.
      ofstream OutFile;

      // Make the new name.
      sprintf_s(NewName,"%s.%s",TableName,GL_Extention);

      // Attempt to open the logfile.
      OutFile.open(NewName,ios::app|ios::binary);
      if (OutFile.fail())
         return false;                  // Failed to open the file.

      // First we need to write the prefix string for new hand.
      if (HandNumber!=NULL)
         OutFile << "Game #" << HandNumber << " starts." << endl << endl;

      // v0.06: If we have been asked to add the 6-max tag, then do so here.
      //        ### NOT really a good place to do this... ###
      if (GL_Add6MaxTag==true) {
         int RMIndex=GetIndexToNextSubString(Buffer," (Real Money)",BufferLen);
         if (RMIndex>=0) {
            OutFile.write(Buffer,RMIndex);
            OutFile.write(" (6 max)",strlen(" (6 max)"));   // Add the 6-max tag.
            OutFile.write(Buffer+RMIndex,BufferLen-RMIndex);
         }

         else {
            OutFile.write(Buffer,BufferLen);   // If can't find, just write as normal.
         }

      }
      else {

         // Write the rest of the buffer.
         OutFile.write(Buffer,BufferLen);
      }


      // Close the file.
      OutFile.close();

      // If we got here, then all ok.
      return true;

   } // End WriteHandHistoryLog.
Scheiße, dass ich so gar keine Ahnung von C hab.
  Mit Zitat antworten Zitat