[Closed] 64 Bit plugin version breaks my file stream
Hi All,
I have an import plugin that I am trying to debug. The plugin works fine with the 32 bit compile but when compiled for 64 bit the file stream reading gets confused. Here is the troubled code. Warning: it is a hack job.
fseek(stream,0,SEEK_END);
if(!fgetpos(stream,&fpos))
{
while(tmpChar != int('
'))
{
count++;
fseek(stream,-count,SEEK_END);
fgetpos(stream,&fpos);
tmpChar = getc(stream);
}
fscanf_s(stream,"%s",data);
nex = atoi(data);
fscanf_s(stream,"%s",data);
ney = atoi(data);
}
So what I need basically is to find the end of the file and save out the last two values. What I do here is seek the end of the file and then work my way back until I find a end of line character then I read the next two values. In 32 bit this works fine but in 64 bit the first data read is screwed up.
For instance the last line in the file is something like.
396200.0 33900200.0 7.95
The first data read returns “” and assigns 0 to nex
The second data read returns 96200.0 and assigns it to ney.
Somewhere in the process the leading 3 is also lost.
Like I said this was a hack job so if anyone has a better way or knows a way to fix this your help will be greatly appreciated.
Thanks,
Rod
parameter is missing…
fscanf_s(stream,”%s”,data, size_of_data_buffer);
guruware