guitarguy1685 Posted March 5, 2010 Posted March 5, 2010 Hello again guys, I have 2 questions concerning *.dat files. 1) Are there any characters used to start comments? like "/" in DCL files and ";" in autolisp. 2) I was reading the page on www.afralisp.net about external files. He gives an example where the .dat files has the following information *6 152.0,10.0,124.0 *7 178.0,12.0,135.0 *8 203.0,14.0,146.0 *9 229.0,16.0,158.0 What are the asterisks for? In his lisp you enter a size, i.e. "6". Then the lisp will add an "*" to the 6 to get "*6". then this bit of code to read each line of text (setq item (read-line fp) When the matching text is found it reads the next line and stores that line to the variable data. If it's reading each line what does it matter if there is an asterisk or not? Quote
Kerry Brown Posted March 5, 2010 Posted March 5, 2010 There is no 'required' format for a .DAT file. The file you mention just uses a format to suit the author who programs to extract the data in the format he expects. The location and structure of the key is a convenience for the programmer, nothing more. Quote
Lee Mac Posted March 5, 2010 Posted March 5, 2010 Exactly as Kerry suggests - the 'comment' identifier can be whatever you like in your program, and just test for it using perhaps: (wcmatch <string> "`**") Lee Quote
JohnM Posted March 5, 2010 Posted March 5, 2010 Comments in DCL comments are with 2 forward slashes // In lisp there are several ways to comment lines ;| Inline |; The single-line comment appears after formatting as any other expression; the multiple-line comment appears starting at a new line ; Single-Semicolon Starts at the comment-column position, as defined by the "Single-Semicolon comment indentation" format option ;; Current-Column The comment appears starting on a new line, indented at the same level as the last line of program code ;;; Heading or 0-Column Appears on a new line, without indentation ;_ Function-Closing Appears just after the previous expression Writing and retrieving data from a file is all up to the programmer. The name of the file and the extension are all up to the programmer as well. (ex: stuff.xyz) When naming a file it is always good practice to name the extension something different than the usual extensions used by a lot of common programs like MS Word has the DOC extension and excel has the XLS extension. Your computer registers common file extensions and that lets it know what program to use when you double click a file. Most of the time a programmer wants to have their file open in word pad so to avoid issues they make up a off the wall extension. You can also make 4-character extension to avoid issues. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.