Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. t30log.c
  5. Abstract:
  6. Decodes faxt30.log
  7. Author:
  8. Rafael Lisitsa (RafaelL) 2-Dec-1996
  9. Revision History:
  10. --*/
  11. #define BUFSIZE 200000
  12. #define D_LEFT 1
  13. #define D_RIGHT 2
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <windows.h>
  17. int _cdecl
  18. main(
  19. int argc,
  20. char *argv[]
  21. )
  22. {
  23. char FileName1[400];
  24. char FileName2[400];
  25. HANDLE hf1;
  26. HANDLE hf2;
  27. char buf1 [BUFSIZE];
  28. char c;
  29. int fEof1;
  30. DWORD BytesRet1=0;
  31. DWORD BytesWritten;
  32. DWORD i;
  33. printf("\nEnter T30 LOG SOURCE filename=>");
  34. scanf ("%s", FileName1);
  35. printf("\nEnter DESTINATION filename=>");
  36. scanf ("%s", FileName2);
  37. hf1 = CreateFile(FileName1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
  38. if (hf1 == INVALID_HANDLE_VALUE) {
  39. printf("\nError opening Source file");
  40. exit (1);
  41. }
  42. hf2 = CreateFile(FileName2, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL);
  43. if (hf2 == INVALID_HANDLE_VALUE) {
  44. printf("\nError opening Destination file");
  45. exit (1);
  46. }
  47. fEof1 = 0;
  48. while ( ! fEof1 ) {
  49. if (! ReadFile(hf1, buf1, BUFSIZE, &BytesRet1, NULL) ) {
  50. printf("\nError reading Source file");
  51. exit (1);
  52. }
  53. if (BytesRet1 != BUFSIZE) {
  54. fEof1 = 1;
  55. }
  56. for (i=0; i<BytesRet1; i++) {
  57. c = buf1[i];
  58. buf1[i] = ( (c << 4 ) & 0xf0 ) | ( (c >> 4) & 0x0f );
  59. }
  60. if (!WriteFile(hf2, buf1, BytesRet1, &BytesWritten, NULL) ) {
  61. printf("\nError writing Dest. file");
  62. exit (1);
  63. }
  64. }
  65. printf("\nDone !");
  66. return (1);
  67. }