PDA

View Full Version : Porting tydemux to Windows


olaf_sc
11-09-2002, 08:19 PM
Hello Folks,

Well underway with the windows version but I run in to trouble. Either Windows in buggy or me just a not used to doing all kinds of magic to get it working.

The issues is that I have trouble doing normal read, write functions. Look at this code:



tmp_record_array = (uint8_t *)malloc(sizeof(uint8_t) * nr_records * 16);
read(file_nr, tmp_record_array,sizeof(uint8_t) * nr_records * 16);


and now how it looks under windows to make it work at all.


for (i=0 ; i < nr_records ; i++) {
tmp_record_array = (uint8_t *)realloc(tmp_record_array, sizeof(uint8_t) * (i +1) * 16);
pt1 = tmp_record_array + (i * 16);
lseek(file_nr, 0, SEEK_CUR);
read(file_nr, pt1,sizeof(uint8_t) * 16);
}


It's definitly funny when you need to do a lseek every time and on top of that you can't read more than say 25, 26 bytes before things go seriusly out of hand.

What happens is that the read reads say 26 bytes skipps one and then contiues. If I read 16 at a time it works just fine :(

Any tips how to make a port working I can't chase small things like this all day it's very unproductive.

Cheers Olaf

olaf_sc
11-09-2002, 08:57 PM
Ahh, some additional information:

Using Visual C++ 6.x with service pack 5 under Win 98.

Cheers Olaf

olaf_sc
11-09-2002, 10:46 PM
Finally got it why it was so strange - really big blunder from my side.

Windows open a file in text mode while Linux doesn't :(. I should have remembered this once but it was a very long time since I did any prog in Windows.

I now have a perfectly working windows version - just need to merge the source files between the two or them (Windows/Linux).

Will post the port along with sources shortly.

Cheers Olaf