Hi,
I've written a program that works fine in windows vista (From which I compiled it), but I need my friend to be able to use it aswell. He uses windows 7. And I can't compile it to work effectively.
I'm using code::blocks with mingw TDM-GCC as I found recommended on a forum for compiling win95+ applications.
My program is very a simple console application and only uses <iostream>, <fstream> and <string>. When it runs in windows 7, I have been told it displays the text and recieves an input string (a char array), then displays the processing information and reports a successful operation. But no files are generated by the ofstream.
I have searched and searched, but cannot find the information I need (maybe I'm blind, but atleast I got this far without asking questions). How can I compile the program to work in windows 7 by compiling it in windows vista?
Since the fstream is what's being affected, i'll post code from the fstream section:
Actually, posting this code has called something to my attention. I found that in vista, no txt output file would be generated unless I put an inbetween command cout << ""; so obviously this isn't working in win7. It's a little work around I found out by experimenting with vc++2010. Having converted to code::blocks was a way of finding a means to compile for win7, becuase the vc++ compilation would require msvcp100.dll which is incompadible with win7. So I guess maybe my code really is the problem... Strangely however, I was told neither an image nor a txt file was generated by the program in windows 7. And my code for the image output does not include a cout << ""; work around. Maybe i'm using a variable name I shouldn't? I'll post a list of variable names as well.
// this finds the image in the input file and outputs the image.
ex_start=(memblock+(*ojnheader).cover_offset);
ex_end=ex_start+(*ojnheader).cover_size;
converter.open("image.jpg",ios::binary|ios::trunc);
converter.write(ex_start,(ex_end-ex_start));
converter.close();
// this writes an array I calculated into a chart text file.
converter.open("chart.txt", ios::trunc);
converter << "\n[data]\n";
loop=keeplength; //keep length typically 1000-2000 in value
while(loop>0) //write notes, starting from the beginning
{
cout << ""; //slow down the saving process so that every slot is saved (instead of only 50%) strange compiler error.
if(cnotes[keeplength-loop]>0)converter << keeplength-loop+1 << "=" << cnotes[keeplength-loop] <<"\n";
loop--;
}
//used variables:
int xread=12;
int xread_factor=1;
int difficulty=0;
int measure;
int length;
int keeplength;
int column;
int lncolumn;
int clumpcolumn;
int current_note;
int current_channel;
int calculate=0;
int scan;
int temp;
int temp2;
int temp3;
int remember=0;
int remember2=0;
int oneshot=0;
int bpmsetting;
int belt;
int read;
int period;
int start_offset=0;
int cnotes[5100];
int cbpm[5100];
int breakdown[192];
int loop=0;
int bigloop=0;
int writemode=0;
int cclumps[33600];