Computing.Net > Forums > Programming > I need help with using files in C#

I need help with using files in C#

Reply to Message Icon

Original Message
Name: El-Trucha
Date: April 9, 2005 at 18:59:57 Pacific
Subject: I need help with using files in C#
OS: Windows XP SP2
CPU/Ram: 2.8 GHz/448 MB
Comment:

OK...I was wandering...how do programs make their own filetypes?? do they do this with databases?? if they do, how can I use one (a database) in a file?? I mean, without a server or M$ Access...
I made a game that saves scores to INI files, and I want to use my own filetype instead of INI...
I'm doing this in C#.
Thanx every1!! ;)

El-Trucha
http://www.truchasoft.tk
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx


Report Offensive Message For Removal


Response Number 1
Name: CharlesAnderson
Date: April 10, 2005 at 08:09:29 Pacific
Subject: I need help with using files in C#
Reply: (edit)

Here is the solution you need:

http://www.mentalis.org/soft/class.qpx?id=5

love is free to all

Charles Anderson

cba@cfanderson.co.uk

228 London Road
Marks Tey
Colchester
Essex
CO6 1HD

Tel: 44 01206 211666
Fax: 44 01206 212363
http://www.cfanderson.co.uk


Report Offensive Follow Up For Removal

Response Number 2
Name: anonproxy
Date: April 10, 2005 at 22:54:44 Pacific
Subject: I need help with using files in C#
Reply: (edit)

A filetype is an abstract thing. It could mean a proprietary binary encoding or just a plaintext file with a random extension. A format may be anything from an HTML file to a PE.

To you, the programmer, all that matters is that you can read and edit the file contents. File extensions/associations have nothing to do with this. Typically programmers use standard file formats which often are supported by major libraries. It's common to have interfaces (classes, what have you) to write, read, modify standard file formats. These are typically built on top of the base file manipulation classes.

There can be more than one way to do this. In your case, I might use a CSV file. I think .NET has a System.Data.ODBC interface that allows you to read a CSV file into a dataset and then perform queries on it. Of course, you could just use a System.IO.File derivative, but then you would have to observe the formatting more carefully. Finally, you could roll your own class to handle reading/writing CSV files.

Databases, mail clients, spreadsheet programs, etc. typically export to CSV.



Report Offensive Follow Up For Removal

Response Number 3
Name: El-Trucha
Date: April 11, 2005 at 19:25:26 Pacific
Subject: I need help with using files in C#
Reply: (edit)

Thanx both of u!! :D
I'll look up on MSDN how to use ODBC...thanx!! ;)

El-Trucha
http://www.truchasoft.tk
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx


Report Offensive Follow Up For Removal

Response Number 4
Name: shriop
Date: April 26, 2005 at 14:10:27 Pacific
Subject: I need help with using files in C#
Reply: (edit)

Keep in mind benchmarks for using this approach. At very least, use the OLE adapter instead of the ODBC.

some pages with benchmarks:
http://www.geocities.com/shriop/csv_benchmarks.html
http://www.codeproject.com/cs/database/CsvReader.asp


Report Offensive Follow Up For Removal

Response Number 5
Name: El-Trucha
Date: April 30, 2005 at 23:40:34 Pacific
Subject: I need help with using files in C#
Reply: (edit)

Thanx for that!! ;)

El-Trucha
http://www.truchasoft.tk
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: I need help with using files in C#

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge