Skip to content
Snippets Groups Projects
Commit 58242ff2 authored by Franck Dary's avatar Franck Dary
Browse files

Fixed a bug where mcd where created with 1 extra column when read from a file.

parent cbf8ab02
No related branches found
No related tags found
No related merge requests found
......@@ -108,7 +108,7 @@ int mcd_get_code(mcd *m, char *str, int col){
return MCD_INVALID_VALUE;
}
/* look for the number of columns in an mcd file */
/* look for the maximum of the indexes of columns in an mcd file, which is 1+nb_col*/
int mcd_max_column_index_in_file(char *mcd_filename)
{
......@@ -183,7 +183,7 @@ mcd *mcd_read(char *mcd_filename, int verbose)
int fields_number;
int line_number = 0;
char buffer[1000]; /* ugly */
int nb_col = mcd_max_column_index_in_file(mcd_filename);
int nb_col = mcd_max_column_index_in_file(mcd_filename) - 1; //-1 because in the file the indexes starts from 1
mcd *m = mcd_new(nb_col + 1);
FILE *f = myfopen(mcd_filename, "r");
/* int first = 1; */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment