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.

32 lines
559 B

  1. #include "TestFuns.h"
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <iostream>
  5. #include <stdio.h>
  6. int ToFile(const char *pFileName, const void *pData, int nLenght)
  7. {
  8. FILE* fp = fopen(pFileName, "wb");
  9. if (fp != 0)
  10. {
  11. fwrite((const char *)pData, 1, nLenght, fp);
  12. fclose(fp);
  13. return 0;
  14. }
  15. return -1;
  16. }
  17. int ABFile(const char *pFileName, const void *pData, int nLenght)
  18. {
  19. FILE* fp = fopen(pFileName, "ab+");
  20. if (fp != 0)
  21. {
  22. fwrite((const char *)pData, 1, nLenght, fp);
  23. fclose(fp);
  24. return 0;
  25. }
  26. return -1;
  27. }