943,700 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 2475
  • C++ RSS
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
Jul 6th, 2009
0

Re: Copying a microsoft word doc

if I ftp any work doc in binary format or asicc format and view the resulting file they are all fine. ftping the copied file that my binary creates does not work fine. So not too sure it's an ftp issue.

What o/s are you using to copy file?
Reputation Points: 6
Solved Threads: 0
Newbie Poster
shealy is offline Offline
14 posts
since Jun 2009
Jul 6th, 2009
0

Re: Copying a microsoft word doc

Oh, I just saw the attachments. Downloaded input.doc and my program copied it correctly, as expected. The output.doc file you attached is unreadable for me too, so the problem is either in the ftp or the solaris operating system. My guess is the ftp program is corrupting the output file.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Jul 6th, 2009
0

Re: Copying a microsoft word doc

Click to Expand / Collapse  Quote originally posted by shealy ...
if I ftp any work doc in binary format or asicc format and view the resulting file they are all fine. ftping the copied file that my binary creates does not work fine. So not too sure it's an ftp issue.

What o/s are you using to copy file?
I am using Microsoft Vista Home Premium and VC++ 2008 Express compiler. No FPT involved. Are you using the code I posted or something you wrote ?

Where did the input.doc file come from that you posted? Was it also FTPd to Windows machine before you posted it here? Or did you post it directly from a browser running on Solaris os ?
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Jul 6th, 2009
1

Re: Copying a microsoft word doc

I agree with AD that the FTP is probably what is going wrong.

FTP defaults to text mode. You must explicitly set it to binary mode before copying files.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
Jul 6th, 2009
0

Re: Copying a microsoft word doc

I wrote two programs - one with an fstream read and write and the other has the code provided in the example above. Both produced the unreadable doc.

I really don't think it's anything to do with ftp. I can ftp any word doc from the server to the desktop and vice-versa in binary mode without any issues - the ftp'd file which has graphics, fonts etc can be opened successfully.

The original input file was ftp'd from the desktop on to the solaris server in binary format.

I am using Microsoft Vista Home Premium and VC++ 2008 Express compiler. No FPT involved. Are you using the code I posted or something you wrote ?

Where did the input.doc file come from that you posted? Was it also FTPd to Windows machine before you posted it here? Or did you post it directly from a browser running on Solaris os ?
Reputation Points: 6
Solved Threads: 0
Newbie Poster
shealy is offline Offline
14 posts
since Jun 2009
Jul 6th, 2009
0

Re: Copying a microsoft word doc

The problem could also be one of Endianness. The byte order on windows and *nix computers are reversed. Maybe your os is writing the bytes out in reverse order during the copy process. To test that use your system's command-line copy function to make the copy, FTP to Windows and check it with MS-Word.
Last edited by Ancient Dragon; Jul 6th, 2009 at 5:48 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Jul 6th, 2009
0

Re: Copying a microsoft word doc

To eliminate ftp as an issue. I ftp'd a doc from desktop to server. ftp'd the doc back to desktop to different location and doc opened successfully.

Copying a doc on server and then ftping is also successful when opening using ms-word.

Does this just leave us with sun solaris?
Reputation Points: 6
Solved Threads: 0
Newbie Poster
shealy is offline Offline
14 posts
since Jun 2009
Jul 6th, 2009
0

Re: Copying a microsoft word doc

did you try my previous suggestion yet?
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Jul 7th, 2009
0

Re: Copying a microsoft word doc

Yes - see previous response - I did the unix copy command, ftp-d to windows and opened with ms-word successfully.

did you try my previous suggestion yet?
Reputation Points: 6
Solved Threads: 0
Newbie Poster
shealy is offline Offline
14 posts
since Jun 2009
Jul 7th, 2009
0

Re: Copying a microsoft word doc

Solved it. The issue is with the read() and write() methods. Using get() and put() works successfully.

Thanks to all who helped.
[

QUOTE=Ancient Dragon;910063]did you try my previous suggestion yet?[/QUOTE]
Reputation Points: 6
Solved Threads: 0
Newbie Poster
shealy is offline Offline
14 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: g++ linker error. Please help.
Next Thread in C++ Forum Timeline: [C++] Problem with changing contents of char[]





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC