Code:
prin1
(prin1 [expr [file-desc]])
Arguments
expr A string or AutoLISP expression. Only the specified expr is
printed; no newline or space is included.
file-desc A file descriptor for a file opened for writing.
Return Values
The value of the evaluated expr. If called with no arguments, prin1 returns a
null symbol.
Returns the UCS 3D point at a specified angle and distance from a point
Prints an expression to the command line or writes an expression to an open file
142 | AutoLISP Reference
Used as the last expression in a function, prin1 without arguments results in
a blank line printing when the function completes, allowing the function to
exit “quietly.”
Examples
Command: (setq a 123 b '(a))
(A)
Command: (prin1 'a)
AA
The previous command printed A and returned A.
Command: (prin1 a)
123123
The previous command printed 123 and returned 123.
Command: (prin1 b)
(A)(A)
The previous command printed (A) and returned (A).
Each preceding example is displayed on the screen because no file-desc was
specified. Assuming that f is a valid file-descriptor for a file opened for writing,
the following function call writes a string to that file and returns the
string:
Command: (prin1 "Hello" f)
"Hello"
If expr is a string containing control characters, prin1 expands these characters
with a leading \, as shown in the following table:
Control codes
Code Description
\\ \ character
\" " character
\e Escape character
\n Newline character
\r Return character
\t TAB character
\nnn Character whose octal code is nnn
princ | 143
The following example shows how to use control characters:
Command: (prin1 (chr 2))
"\002""\002"
SEE ALSO “Displaying Messages” in the Visual LISP Developer’s Guide.
princ
(princ [expr [file-desc]])
This function is the same as prin1, except control characters in expr are
printed without expansion. In general, prin1 is designed to print expressions
in a way that is compatible with load, while princ prints them in a way that
is readable by functions such as read-line.
Arguments
expr A string or AutoLISP expression. Only the specified expr is
printed; no newline or space is included.
file-desc A file descriptor for a file opened for writing.
Return Values
The value of the evaluated expr. If called with no arguments, princ returns a
null symbol.
SEE ALSO “Displaying Messages” in the Visual LISP Developer’s Guide.
print
(print [expr [file-desc]])
This function is the same as prin1, except it prints a newline character before
expr, and prints a space following expr.
Arguments
expr A string or AutoLISP expression. Only the specified expr is
printed; no newline or space is included.
Prints an expression to the command line, or writes an expression to an open file
Prints an expression to the command line, or writes an expression to an open file
144 | AutoLISP Reference
file-desc A file descriptor for a file opened for writing.
Return Values
The value of the evaluated expr. If called with no arguments, print returns a
null symbol.