summaryrefslogtreecommitdiff
path: root/htk_io
diff options
context:
space:
mode:
Diffstat (limited to 'htk_io')
-rw-r--r--htk_io/tools/tnet_to_nerv.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/htk_io/tools/tnet_to_nerv.cpp b/htk_io/tools/tnet_to_nerv.cpp
index bbfddcf..a779a25 100644
--- a/htk_io/tools/tnet_to_nerv.cpp
+++ b/htk_io/tools/tnet_to_nerv.cpp
@@ -2,9 +2,10 @@
#include <fstream>
#include <string>
#include <cstring>
+#include <cstdlib>
char token[1024];
char output[1024];
-double mat[4096][4096];
+double **mat;
int main(int argc, char **argv) {
std::ofstream fout;
fout.open(argv[1]);
@@ -18,6 +19,9 @@ int main(int argc, char **argv) {
scanf("%d %d", &ncol, &nrow);
scanf("%s %d %d", token, &ncol, &nrow);
printf("%d %d\n", nrow, ncol);
+ mat = (double **)malloc(nrow * sizeof(double *));
+ for (i = 0; i < nrow; i++)
+ mat[i] = (double *)malloc(ncol * sizeof(double));
for (j = 0; j < ncol; j++)
for (i = 0; i < nrow; i++)
scanf("%lf", mat[i] + j);
@@ -34,7 +38,9 @@ int main(int argc, char **argv) {
for (j = 0; j < ncol; j++)
fout << mat[i][j] << " ";
fout << std::endl;
+ free(mat[i]);
}
+ free(mat);
long length = fout.tellp() - base;
fout.seekp(base);
sprintf(output, "[%13lu]\n", length);