![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
![]() |
![]() | | LinkBack | Thread Tools | Display Modes | ![]() |
| |
| ||||
| Here's the byte writer for C#: PHP Code: ![]() I'm pretty sure that C# also has another type of writer that will let you write it line by line. You'd probably want to double check on that... |
| The Following User Says Thank You to HelloWorld For This Useful Post: | ||
TeraTask (08-03-2007) | ||
| ||||
| Thanks. What I meant, though, was what format do you choose to store it in? For example, if I were collecting website, username, and password, then I could store it like Code: website1,username1,password1 website2,username2,password2 website3,username3,password3 Code: <site> <url>website1</url> <username>username1</username> <password>password1</password> </site> <site> <url>website2</url> <username>username2</username> <password>password2</password> </site> <site> <url>website3</url> <username>username3</username> <password>password3</password> </site> Does that make more sense? |
| ||||
| I'd personally like the first one better: Code: website1,username1,password1 website2,username2,password2 website3,username3,password3 |
| The Following User Says Thank You to HelloWorld For This Useful Post: | ||
TeraTask (08-03-2007) | ||
| |||
| XML is common, and INI files are still used too. Honestly, it doesn't matter which one you use since they're both text. If the language has a specific facility for reading and parsing XML, it may be faster than using an INI file, though a language may also have built-in support for reading and parsing an INI file too. You could also use a binary file format, where the lengths of the "records" are varied in length. For example, you could have the equivalent of the following to store usernames (thinking about it like a hex editor): 'd' 'u' 'm' 'm' 'y' 00 'F' 's' 't' 00 You could also store the length, eliminating the need to check for a null terminator and also allowing you to have more control because you would not be reading an unknown number of bytes until you hit a null terminator, which may in fact be absent if improperly coded. The downside to this method is that you would need to ensure that it is saved properly, which would most likely require a hex editor if you don't have one already. __________________ "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off." -- Bjarne Stroustrup, creator of what is now known as C++ For more quotes by Bjarne Stroustrup, check out http://www.research.att.com/~bs/bs_faq.html#really-say-that. |
| The Following 2 Users Say Thank You to rpgfan3233 For This Useful Post: | ||
HelloWorld (08-03-2007), TeraTask (08-03-2007) | ||
| ||||
| Quote:
I think Java has XML parser or something like that. I can pretty much assume that C# also has it since they're both really similar. |
| ||||
| XML bothers me b/c it takes up so much space and offers little in return for data that doesn't need to be transferred between various applications while complicating the parsing of the data substantially. I think I'll go ahead and stick with a csv-like format, but stored in binary. I don't know much about the .ini file format. Thanks for all the tips and feedback - very much appreciated! |
| ||||
| I like using XML the most, i have used it a couple of times now, once you start getting your head round parsing it in your language of choice then you see its not really that hard to save, delete, create etc... XML is also good if you want the user to be able to change the settings from that file, lets say there's an error in the application on load in a version where your error handling is not 100%, they can just change a setting in the XML file to make it all work again, rather than a reinstall or something like that. Another good example is when you have different languages and the user is computer literate (Or has a user guide) and would like to change something in there language, say you have a button with the text "Exit" from the XML file, the user could change it to "Close" or something like that, which can be good as users like it when things are the way they want. |
| The Following 2 Users Say Thank You to Lee For This Useful Post: | ||
HelloWorld (08-03-2007), TeraTask (08-03-2007) | ||
![]() |
| Thread Tools | |
| Display Modes | |
| |