title: How to read bytes until a certain character is encountered in C
body: <p>I'm wanting to read a string of bytes for processing by a character table in C, that is until a character is encountered (<code>0xFF</code>). Basically, I'm creating a function that is supposed to process text out of a static binary file that uses a custom character set into ANSI.</p>
  
  <p>The code I have looks like this:</p>
  
  <pre><code>short ReadText(char * Path, char * Offset) {
      //Declare variables
      size_t ReadResult;
      FILE * OpenedFile;
      short Position;
      char CurrentChar;
      char FormattedChar;
      char * FileContents;
  
      //Populate variables
      OpenedFile = fopen(Path, "r");
  
      do { 
          // &gt;&gt;&gt; Code to gather bytes &lt;&lt;&lt;
      }
      //Initiate character conversion
      do {
          fseek(OpenedFile, Position, SEEK_SET);
          CurrentChar = fread(
  
          //Character switch I/O
          switch(CurrentChar) {enter code here
              case 0x00: FormattedChar = ' ';
              case 0x01: FormattedChar = 'À';
              case 0x02: FormattedChar = 'Á';
              case 0x03: FormattedChar = 'Â';
              // . . .
          }
      }
  }
  </code></pre>
  
  <p>What I need to know how to do is to read bytes from an offset into a <code>char*</code> until the original charset's terminating byte is encountered (which is <code>0xFF</code>). How can I do that?</p>