home *** CD-ROM | disk | FTP | other *** search
- # include <stdio.h>
-
- typedef char string80[80];
-
- void LotusFileSave(float *datary,string80 rowlabel[], string80 collabel[],
- int numrow,int numcol,char filename[])
- {
-
-
-
- int i;
- int j;
- char comma;
- char space;
- char quote;
- FILE *fp;
-
-
- comma = 44;
- space = 32;
- quote = 34;
-
- fp = fopen(filename,"w");
- fprintf(fp, "%c %c%c%c", quote, space, quote, comma);
- for ( j = 0; j <= numcol-1; ++j ) {
- if ( j < numcol-1 ) {
- fprintf(fp, "%c%s%c%c ", quote, (collabel[j] ), quote, comma);
- }
- else {
- fprintf(fp, "%c%s%c\n", quote, (collabel[j] ), quote);
- }
- }
- for ( i = 0; i <= numrow-1; ++i ) {
- fprintf(fp, "%c%s%c%c", quote, (rowlabel[i] ), quote, comma);
- for ( j = 0; j <= numcol-1; ++j ) {
- if ( j < numcol-1 ) {
- fprintf(fp, "%12.4f%c", datary[i*numcol+j], comma);
- }
- else {
- fprintf(fp, "%12.4f\n", datary[i*numcol+j]);
- }
- }
- }
- fprintf(fp, "%c", 26);
- fflush(fp);
- fclose(fp);
- }