home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / HORNDRV1.ZIP / TSTDRV.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-23  |  1.4 KB  |  45 lines

  1. #include <dos.h>
  2. #include <mem.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6.  
  7. void main(int argc, char **argv)
  8. {
  9. char    achSay[BUFSIZ],
  10.        *pszSay;
  11. FILE   *pFile,
  12.        *pPhonemFile;
  13.  
  14.     if(argc > 1)
  15.     {
  16.         if((pPhonemFile = fopen("$talk$", "r+")) != NULL)
  17.         {
  18.             /* Flush previous words */
  19.             rewind(pPhonemFile);
  20.             fgets(achSay, sizeof(achSay), pPhonemFile);
  21.             /* Open the words file */
  22.             if((pFile = fopen(argv[1], "r")) != NULL)
  23.             {
  24.                 while(fgets(achSay, sizeof(achSay), pFile) != NULL)
  25.                 {
  26.                     if(achSay[0] != '#') // If not a comment process
  27.                     {
  28.                         /* Get the first word  */
  29.                         pszSay = strtok(achSay, " ");
  30.                         printf("Word is [%s] ", pszSay);
  31.                         /* And speak it */
  32.                         fprintf(pPhonemFile, "%s\n", pszSay);
  33.                         /* Must be rewind for this driver */
  34.                         rewind(pPhonemFile);
  35.                         /* Return the phoneme translation */
  36.                         fgets(achSay, sizeof(achSay), pPhonemFile);
  37.                         printf("phoneme is [%s]\n", achSay);
  38.                     }
  39.                 }
  40.                 fclose(pFile);
  41.             }
  42.             fclose(pPhonemFile);
  43.         }
  44.     }
  45. }