473,385 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to save an existing file into a new file using "save as" method?

Hai to all,

if i'm having a file named as "tab.doc" which is a microsoft word document file ...

i want to save it as another file as "tab1.doc" by using

"save as" method....

Is there any "save as" method available for doing this process in VC++....

thanks in advance..
senthil..
Jan 10 '07 #1
8 3603
Hai
can anybody help me...

i want to save the content of an existing file into a newly created file by using
the "save as" method...

for example if i'm having tab.doc which is a manually created ms word document
file...

then i want to the save the contents of tab.doc file into a new file tab1.doc. by

using "SaveFileAs" method...

How can i do it..

Can any body plzz help me..
Jan 10 '07 #2
Banfa
9,065 Expert Mod 8TB
You question is not clear, you have not described your problem in enough detail.

Why would you want to use C++ for this?
Why can't you just select Save As from the work menu?
Why can't you use copy?
What is the purpose of the program you are trying to write?
Jan 10 '07 #3
Hai...

thanks for ur reply..

mainly i want to automate that process in my project...

Actually i'm a Adobe indesign plugin developer...

i'm developing indesing plugin's using VC++..

i want to import a html file into indesign document...

but indesign does not support html...

thats y i'm trying import doc file(ms word)...

ok plzz tell me how to copy the contents of one file(ie tab.doc) into the

another file(tab1.doc)....

is there any source code available for doing this proces...

plzz help me its very urgent...

thanks...
senthil
Jan 10 '07 #4
Banfa
9,065 Expert Mod 8TB
Assuming you have access to the Windows API then I suggest you use

BOOL CopyFile(
LPCTSTR lpExistingFileName,
LPCTSTR lpNewFileName,
BOOL bFailIfExists
);

or

BOOL CopyFileEx(
LPCTSTR lpExistingFileName,
LPCTSTR lpNewFileName,
LPPROGRESS_ROUTINE lpProgressRoutine,
LPVOID lpData,
LPBOOL pbCancel,
DWORD dwCopyFlags
);


If you don't have access to the Windows API then you will need to use functions

fopen
fclose
fread
fwrite

To open the source and destination files (in binary mode) read data from the source and write data to the destination and then close both files again.
Jan 10 '07 #5
Hai Banfa,

thanks for ur reply...

Itz working supervly...

But this CopyFile() method is not suitable for my project...

I want only "SaveAs" method for my project....

Can u please tell me

How to save an old file into a new fie by using "save as"...

The manual process is that...

if there is a file named 1.doc... we will open it with ms word...

then click file->save as.. button for saving the contents of 1.doc to a
new file named as 2.doc...

I want to automate this process in my program using any SaveAs() method
like CopyFile() method

is there any source code available for this process...

plzz help me...

thanks for ur reply..
senthil..
Jan 11 '07 #6
Banfa
9,065 Expert Mod 8TB
There is no such method as SaveAs.

If you open a document in Word and then "Save As" you are effectively copying it which is what CopyFile does.
Jan 11 '07 #7
Hai Banfa,

thanks for ur suggestions and responses...

then otherwise...

Then plzz tell me how to save the content of webpage into an image file...

in C++...

i found that saveToFile() is available for doing that...

i found a sample code in the net also...

Expand|Select|Wrap|Line Numbers
  1. void DownloadHtml(void)
  2.     {
  3.     CkHttp http;
  4.  
  5.     CkString strHtml;
  6.     bool success = http.QuickGetStr("C:/1.html",strHtml);
  7.  
  8.     // Save the HTML to a file.
  9.     strHtml.saveToFile("1.jpg");
  10.  
  11.     }
  12.  
  13. But dont know how to use the above function in my project..
  14.  
  15. it showing errors like 
  16. 'http': identifier not found, even with argument-dependent lookup
  17. 'CkString' : undeclared identifier
  18. 'CkHttp' : undeclared
identifieri'm a beginner to c++...
i think these are only small problems...

will u plzz help me...
thanks
senthil..
Jan 11 '07 #8
Banfa
9,065 Expert Mod 8TB
That code relies on the classes CkHttp, CkString which are products of Chilkat software. If you have and are willing to spend the several $100 they cost I would suggest that you then contact Chilkat support for help in using them.

You may be able to do something with the MFC classes CHttpConnection and CHtmlView. Perhaps you can get CHtmlView to render to a jpg file instead of the screen.

Otherwise it's a case of loading the HTML (and related files, css and images for example), rendering it to an image and then saving that image in JPG format.
Jan 11 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Francesc Guim Bernat | last post by:
Dear Colleagues, i'm developing a C++ .NET based application that works with System.Xml library. My problem appears when i try to save a document througt XmlDocument->Save method, because it...
1
by: Francesc Guim Bernat | last post by:
Dear Colleagues, i'm developing a C++ .NET based application that works with System.Xml library. My problem appears when i try to save a document througt XmlDocument->Save method, because it...
15
by: Bobby C. Jones | last post by:
Is there an advantage to either of these methods, or is it simply a matter of style? I used to use the "as" method, but later gave it up for the "is" method as the intent of the code seems a...
4
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. ...
5
by: Paul Sullivan | last post by:
We are a state agency that views protected medical information via our intranet. The screens even have privacy shields. Alarmingly, uses can "Print" and "Save As" which destroys the protection of...
3
by: B-Dog | last post by:
I'm checking some files to see if the filenames are in a certain format and if not I want to pull up a dialog box that gives me a save as with the file that is in question. I have all the files in...
5
by: Dave | last post by:
What is the benefit of using "as" vs the other? HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://www.contoso.com/"); vs. HttpWebRequest myReq...
1
by: kurtrips | last post by:
I am trying to use M$'s XMLDOM's save method but it is doing absolutely nothing. xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("bestscores.xml");...
1
by: suitland | last post by:
Hi All, I am using the execCommand(SaveAs) function to save an HTML file as an xls file, and works fine when I open the program and open the file. Is there anyway I can trigger an Open dialog box...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.