Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2006
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    .dat and .txt files

    Is there any difference when including a .dat or .txt file?
    I havent seen any difference with its effectiveness, both can store content and print, besides .dat looks like a cooler extention to organize files - is there any gain?

  • #2
    Regular Coder
    Join Date
    May 2007
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In fact the .dat file can be just .txt file with .dat extension but originally text files .txt consist of lines terminated with a CR/LF (#13#10) combination (or just LF Unix/Linux or CR Mac), and typed files .dat consist of data taken from a particular type of data structure.
    Forum for webmasters and developers
    http://www.htmlfrenzy.com
    Are you an IT expert? Join our Reward system
    www.htmlfrenzy.com/reward-system.php

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,590
    Thanks
    0
    Thanked 644 Times in 634 Posts
    A .dat file can contain ANYTHING depending on which program it is intended to be used with. In most cases it will not contain readable text or if it does there will usually be non readable portions as well.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,009
    Thanks
    2
    Thanked 312 Times in 304 Posts
    Even though you posted this in the HTML forum section, I assume that you are talking about using PHP to include these?

    A word of caution about putting PHP code (including PHP variable and constant define(...) statements) in files that do not have a .php extension. If you put PHP code/variable/define statements in files that have a .htm, .html, .txt, .dat, .inc, ... or any other extension that is not parsed by the PHP language engine, then anyone that learns or guesses the file name can directly browse (or use a script) to your file and see the exact contents of that file. Only put PHP code/variable/define statements in a .php file (or an alternate extension that you have setup on your server to be parsed as PHP code.)
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •