473,322 Members | 1,287 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,322 software developers and data experts.

how to change filetype?

i have a file "a.mp3"
but i want wo change it to "a.asf"(not in convert,only to change the file
header and extent)

how to?

thanks
Nov 16 '05 #1
3 4146
I believe you are looking for the Path.ChangeExtension (System.IO
namespace).

ShaneB

"li***@0536.net" <li******@sina.com.cn> wrote in message
news:Ot**************@TK2MSFTNGP10.phx.gbl...
i have a file "a.mp3"
but i want wo change it to "a.asf"(not in convert,only to change the file
header and extent)

how to?

thanks

Nov 16 '05 #2
On Fri, 12 Nov 2004 16:10:15 +0800, "li***@0536.net"
<li******@sina.com.cn> wrote:
i have a file "a.mp3"
but i want wo change it to "a.asf"(not in convert,only to change the file
header and extent)

how to?

thanks


To change file extensions this works well

string newFilename = openFileDialog1.FileName;
newFilename = newFilename.Substring(0, filename.LastIndexOf(@".")) +
".asf";
File.Move(openFileDialog1.FileName, newFilename);
Nov 16 '05 #3
For some reason I thought he was just trying to change the filename as a
string...it's early here :) Combining with Arne's code, we get:

string newFilename = openFileDialog1.FileName;
File.Move( openFileDialog1.FileName,
Path.ChangeExtension(openFileDialog1.FileName, ".asf") );

ShaneB

<Arne Schittenhelm> wrote in message
news:jo********************************@4ax.com...
On Fri, 12 Nov 2004 16:10:15 +0800, "li***@0536.net"
<li******@sina.com.cn> wrote:
i have a file "a.mp3"
but i want wo change it to "a.asf"(not in convert,only to change the file
header and extent)

how to?

thanks


To change file extensions this works well

string newFilename = openFileDialog1.FileName;
newFilename = newFilename.Substring(0, filename.LastIndexOf(@".")) +
".asf";
File.Move(openFileDialog1.FileName, newFilename);

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Keith Brown | last post by:
I have an application that allows embedded storage of ANY chosen file in an OLE field. The file could have been dragged-and-dropped into the field or it might have been selected and imported...
10
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
16
by: Phil Hey | last post by:
Hi, I can change the icon for a folder by right clicking on it > going to the customize tab > and selecting Choose Picture. Does anyone know if it is possible to do this programmatically...
7
by: kids_pro | last post by:
I found FileInfo expose alot of methods & properties. However I can't get FileType from FileInfo I can only get File extension. How can I get fileType any build-in library allow me to do that?...
2
by: MacKris | last post by:
Hi, I'm a chemist trying to use the python script GaussSum.py with gnuplot for creating dataplots, and need some help. Whenever I try to produce a plot from the GaussSum GUI I get the error sh:...
0
by: Stuman | last post by:
>From a previous message that I am unable to reply to, here it is again From: Steve Podradchik - view profile Date: Wed, Mar 5 2003 4:29 am Email: "Steve Podradchik"...
2
aestheticmind
by: aestheticmind | last post by:
Hello, How do you evaluate multiple values in a single Variable? Can someone give me a hand on how to set $filter so that it will evaluate all of the values. Right now it will only eval the first...
11
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RowSource of a Master Report is: Me.RowSource = "TableOrQueryName"
1
by: monkey1001 | last post by:
my program is suppose to show my due change and i got it working but my change and coins are wrong how can i improve it thank you..(its supposed to be in java)
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.