Author Topic: Converting a .txt file to a .cs  (Read 12878 times)

Stupid question.
I don't know how to do it.

Depends on your operating system.

On XP, (and maybe others, not sure)

-Open the folder it's in.
-Tools>Folder options...
-[View]
-Uncheck "Hide extensions for known file types"
-[OK]

Then rename it to a .cs file.
Do not do this for any other type of file, such as images, sounds, videos, etc.


I was about to post some script to re-write a .txt into a .cs, but then I saw Chrono's post.

And as I was typing this, I thought: fileCopy(%path @ %filename @ ".txt", %path @ %filename @ ".cs"); Which I never use fileCopy to know if that would work.

I belive it goes something like this:
%filefrom = new FileObject();
%filefrom.openforread(path);
%fileto = new FileObject();
%fileto.openforwrite(path)
%filefrom.copy();
%fileto.paste();
%filefrom.close();
%filefrom.delete();
%fileto.close();
%fileto.delete();

%filefrom.copy();
%fileto.paste();

This part is where you'd put real code, btw.

You should get Notepad++, makes life easier for all scripting languages:D

I belive it goes something like this:
%filefrom = new FileObject();
%filefrom.openforread(path);
%fileto = new FileObject();
%fileto.openforwrite(path)
%filefrom.copy();
%fileto.paste();
%filefrom.close();
%filefrom.delete();
%fileto.close();
%fileto.delete();
No.
Please do not post things if you only 'think' its right.
Please be absolutely sure. This is a help section, not a research section.

You should get Notepad++, makes life easier for all scripting languages:D
This isn't related to the topic.

Chrono, do you think what I said about fileCopy would work?

I'm not sure how to do fileCopy exactly, but it seems right.

Chrono, do you think what I said about fileCopy would work?
It would work.

I just re-name the .txt file to .cs

I just re-name the .txt file to .cs
Can't do that without proper settings.

Make a copy of a server.cs file, copy the contents of the txt file, paste into the cs file, rename the cs file.

Ta-da. No need to change any settings (Although changing them would be faster).


Probably the most convenient way.