Link to home
Start Free TrialLog in
Avatar of RKulwiec
RKulwiec

asked on

CFile::Write not working properly on a network drive unless I add one to the number of bytes.

I am having a problem writing out to a file on a network drive.  When I call the CFile Write function, the computer hangs for about a minute, then eventally displays an error message that access to the file is denied.  I have write access to the network drive.  This problem only happens when using the network drive.  It works fine when writing to a local drive.  The command I use is:

fp->Write(c,strlen(c));

But the funny thing is, if I add one to the number of bytes being sent, such as:

fp->Write(c,strlen(c)+1);

then it works fine.  Does anybody know why this is?  Has anyone else ever experienced anything like this?

c is a character string.  I have allowed enough space for the string.  I can't find anywhere where I don't allow enough memory.

Thank you,

Ray
Avatar of williamcampbell
williamcampbell
Flag of United States of America image


  IS c Zero terminated? If not then strlen may return a huge value.
Avatar of RKulwiec
RKulwiec

ASKER

Yes.  c is zero terminated.
ASKER CERTIFIED SOLUTION
Avatar of williamcampbell
williamcampbell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial