Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Function definitions for operations on vectors in 3-space.
- #include <stdio.h>
- #include "vec6C.h"
- int save_precisely(const char *filename, const vec_t *a, int n)
- {
- int i, fcl;
- FILE *fp;
- fp = fopen (filename, "w");
- if (fp == NULL)
- return OPEN_FAILED;
- for (i = 0; i < n; i++)
- {
- fprintf(fp,"%.20e %.20e %.20e\n", a[i].x, a[i].y, a[i].z);
- }
- fcl = fclose(fp);
- if (fcl != 0)
- return CLOSE_FAILED;
- return SUCCESS;
- }
- int save_fancily(const char *filename, const vec_t *a, int n)
- {
- int i, fcl;
- FILE *fp;
- fp = fopen (filename, "w");
- if (fp == NULL)
- return OPEN_FAILED;
- for (i = 0; i < n-1; i++)
- {
- fprintf(fp, "element %d: (%.4f, %.4f, %.4f) \n", i, a[i].x, a[i].y, a[i].z);
- }
- fcl = fclose(fp);
- if (fcl != 0)
- return CLOSE_FAILED;
- return SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement