| Author |
How to save a file in default format
|
pradipta kumar rout
Ranch Hand
Joined: Sep 13, 2010
Posts: 43
|
|
Sir,
I want to store a file from URL and it should be in the default format
example:
suppose i want to save the content of URL=http://www.youtube.com
my objectives is to
1.I want to save the file in the default format it have ,
2.I don't know what the file format but it should save in that .
3.Suppose a Url contain xyz format then it should save in . that format in a .txt file.
4.I want to save this in this format.
I know how to save a file from URL using URL class and writer Classes but do not know how to save in the default format ,
I have tried and the content of http://www.youtube.com is UNICODE but it is stored in ANSI format so how to save it in that .
So kindly tell me a suggestion....
I am doing my project it will very helpful for me
|
 |
Madhan Sundararajan Devaki
Ranch Hand
Joined: Mar 18, 2011
Posts: 312
|
|
Get the filename of the resource and write out the contents into a new file with this filename. Normally the filename will have some indication as to the format of the file. For example, Letter.txt will be a text file, so writing it out as a Letter.txt will also be a text file. Prefer writing in binary mode only, so that you do not corrupt contents accidentally.
|
S.D. MADHAN
Not many get the right opportunity !
|
 |
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
|
I wouldn't look at the filetype. For instance an website page with the name content.php will almost never return php code but rather an html file. You could look at the mime type that is returned by the server.
|
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
|
 |
 |
|
|
subject: How to save a file in default format
|
|
|