Commit 3bd25791 authored by Leonardo Solis's avatar Leonardo Solis
Browse files

correct fopen to read in binary mode, work on lnx and win

parent 70bc42f5
...@@ -556,7 +556,7 @@ void gen_initpop_and_reflig(Dockpars* mypars, ...@@ -556,7 +556,7 @@ void gen_initpop_and_reflig(Dockpars* mypars,
} }
else else
{ {
fp = fopen("initpop.txt","r"); fp = fopen("initpop.txt","rb"); // fp = fopen("initpop.txt","r");
if (fp == NULL) if (fp == NULL)
{ {
printf("Warning: can't find initpop.txt. A new population will be generated.\n"); printf("Warning: can't find initpop.txt. A new population will be generated.\n");
......
...@@ -36,7 +36,7 @@ int get_gridinfo(const char* fldfilename, Gridinfo* mygrid) ...@@ -36,7 +36,7 @@ int get_gridinfo(const char* fldfilename, Gridinfo* mygrid)
// ---------------------------------------------------- // ----------------------------------------------------
//Processing fld file //Processing fld file
fp = fopen(fldfilename, "r"); fp = fopen(fldfilename, "rb"); // fp = fopen(fldfilename, "r");
if (fp == NULL) if (fp == NULL)
{ {
printf("Error: can't open fld file %s!\n", fldfilename); printf("Error: can't open fld file %s!\n", fldfilename);
...@@ -152,7 +152,7 @@ int get_gridvalues_f(const Gridinfo* mygrid, float** fgrids) ...@@ -152,7 +152,7 @@ int get_gridvalues_f(const Gridinfo* mygrid, float** fgrids)
strcat(tempstr, "."); strcat(tempstr, ".");
strcat(tempstr, mygrid->grid_types[t]); strcat(tempstr, mygrid->grid_types[t]);
strcat(tempstr, ".map"); strcat(tempstr, ".map");
fp = fopen(tempstr, "r"); fp = fopen(tempstr, "rb"); // fp = fopen(tempstr, "r");
if (fp == NULL) if (fp == NULL)
{ {
printf("Error: can't open %s!\n", tempstr); printf("Error: can't open %s!\n", tempstr);
......
...@@ -25,7 +25,7 @@ int init_liganddata(const char* ligfilename, ...@@ -25,7 +25,7 @@ int init_liganddata(const char* ligfilename,
char atom_types [14][3]; char atom_types [14][3];
char tempstr [256]; char tempstr [256];
fp = fopen(ligfilename, "r"); fp = fopen(ligfilename, "rb"); // fp = fopen(ligfilename, "r");
if (fp == NULL) if (fp == NULL)
{ {
printf("Error: can't open ligand data file %s!\n", ligfilename); printf("Error: can't open ligand data file %s!\n", ligfilename);
...@@ -664,7 +664,7 @@ int get_liganddata(const char* ligfilename, Liganddata* myligand, const double A ...@@ -664,7 +664,7 @@ int get_liganddata(const char* ligfilename, Liganddata* myligand, const double A
atom_counter = 0; atom_counter = 0;
fp = fopen(ligfilename, "r"); fp = fopen(ligfilename, "rb"); // fp = fopen(ligfilename, "r");
if (fp == NULL) if (fp == NULL)
{ {
printf("Error: can't open ligand data file %s!\n", ligfilename); printf("Error: can't open ligand data file %s!\n", ligfilename);
...@@ -711,7 +711,7 @@ int get_liganddata(const char* ligfilename, Liganddata* myligand, const double A ...@@ -711,7 +711,7 @@ int get_liganddata(const char* ligfilename, Liganddata* myligand, const double A
atom_rotbonds_temp [i][j] = 0; atom_rotbonds_temp [i][j] = 0;
} }
fp = fopen(ligfilename, "r"); //re-open the file fp = fopen(ligfilename, "rb"); // fp = fopen(ligfilename, "r"); //re-open the file
if (fp == NULL) if (fp == NULL)
{ {
printf("Error: can't open ligand data file %s!\n", ligfilename); printf("Error: can't open ligand data file %s!\n", ligfilename);
...@@ -825,7 +825,7 @@ int gen_new_pdbfile(const char* oldpdb, const char* newpdb, const Liganddata* my ...@@ -825,7 +825,7 @@ int gen_new_pdbfile(const char* oldpdb, const char* newpdb, const Liganddata* my
acnt_oldlig = 0; acnt_oldlig = 0;
acnt_newlig = 0; acnt_newlig = 0;
fp_old = fopen(oldpdb, "r"); fp_old = fopen(oldpdb, "rb"); // fp_old = fopen(oldpdb, "r");
if (fp_old == NULL) if (fp_old == NULL)
{ {
printf("Error: can't open old pdb file %s!\n", oldpdb); printf("Error: can't open old pdb file %s!\n", oldpdb);
......
...@@ -547,7 +547,7 @@ void clusanal_gendlg(Ligandresult myresults [], int num_of_runs, const Liganddat ...@@ -547,7 +547,7 @@ void clusanal_gendlg(Ligandresult myresults [], int num_of_runs, const Liganddat
fprintf(fp, " INPUT LIGAND PDBQT FILE:\n ________________________\n\n\n"); fprintf(fp, " INPUT LIGAND PDBQT FILE:\n ________________________\n\n\n");
fp_orig = fopen(mypars->ligandfile, "r"); fp_orig = fopen(mypars->ligandfile, "rb"); // fp_orig = fopen(mypars->ligandfile, "r");
while (fgets(tempstr, 255, fp_orig) != NULL) //reading original ligand pdb line by line while (fgets(tempstr, 255, fp_orig) != NULL) //reading original ligand pdb line by line
{ {
...@@ -605,7 +605,7 @@ void clusanal_gendlg(Ligandresult myresults [], int num_of_runs, const Liganddat ...@@ -605,7 +605,7 @@ void clusanal_gendlg(Ligandresult myresults [], int num_of_runs, const Liganddat
fprintf(fp, "DOCKED: USER\n"); fprintf(fp, "DOCKED: USER\n");
fp_orig = fopen(mypars->ligandfile, "r"); fp_orig = fopen(mypars->ligandfile, "rb"); // fp_orig = fopen(mypars->ligandfile, "r");
atom_cnt = 0; atom_cnt = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment