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
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