file termination

  • Thread starter flintridgeparkenfarker vonkerschnauzerheiden
  • Start date
F

flintridgeparkenfarker vonkerschnauzerheiden

Hi,

I needed to upgrade a driver on my laptop, couldn't get online with it, so I
wrote a down and dirty file splitter enabling me to transfer the new modem
drivers to it via floppy. The .exe was successfully reunited and installed.
Everything works fine; however, the file checksums are not the same before
and after the split and rejoining.

I've tested this with text files and always come up with the same looking
file as I started with after splitting and joining, but the checksums are
different.

This is how I'm appending the file file bytes to the rejoined file:

_tfopen(GetFilename().c_str(), _T("ab"));

....and then just looping through the bytes of the next buffer without adding
or subtracting any terminating char's, or EOF {which seems to happen
automatically when I'm finished anyways}.

I can't figure why the checksums are different.
 
K

Karthik Kumar

flintridgeparkenfarker said:
Hi,

I needed to upgrade a driver on my laptop, couldn't get online with it, so I
wrote a down and dirty file splitter enabling me to transfer the new modem
drivers to it via floppy. The .exe was successfully reunited and installed.
Everything works fine; however, the file checksums are not the same before
and after the split and rejoining.

I've tested this with text files and always come up with the same looking
file as I started with after splitting and joining, but the checksums are
different.

This is how I'm appending the file file bytes to the rejoined file:

_tfopen(GetFilename().c_str(), _T("ab"));

How does this function look like ?
Also did you remember to open the file in binary mode while reading and
writing ?
 
F

flintridgeparkenfarker vonkerschnauzerheiden

Karthik Kumar said:
How does this function look like ?
Also did you remember to open the file in binary mode while reading and
writing ?


Yeah, this is the function:

ushort FileSplitter::Append(uchar bytes[], ulong size) {
FILE *_file = _tfopen(GetFilename().c_str(), _T("ab"));
if (_file==NULL) {
cout << _T("Couldn't open file to append.") << endl;
return 0;
}
for (ulong i=0; i < size; i++) {
_ftprintf(_file, _T("%c"), bytes);
}
fclose(_file);
return 1;
}

I mean, if a modem driver installation can be broken into 3 pcs, rejoined
and then still install and function properly, what in the * could be
changing the checksum?
 
F

flintridgeparkenfarker vonkerschnauzerheiden

I found the problem. It was something I had changed while debugging prior to
making my last copy. Dumb oversight.

Thanks though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,634
Latest member
RonnyBoelk

Latest Threads

Top