Prints an expression to the command line or writes an expression to an open file
(prin1 [expr [file-desc]])
Arguments
A string or AutoLISP expression. Only the specified expr is printed; no newline or space is included.
A file descriptor for a file opened for writing.
Return Values
prin1 returns a null symbol.
The value of the evaluated expr. If called with no arguments,prin1 without arguments prints a blank line when the function completes, allowing the function to exit “quietly.â€
Used as the last expression in a function,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).
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:
Each preceding example is displayed on the screen because no file-desc was specified. Assuming thatCommand: (prin1 "Hello" f)
"Hello"
prin1 expands these characters with a leading \, as shown in the following table:
If expr is a string containing control characters,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 |
The following example shows how to use control characters:
Command: (prin1 (chr 2))
"\002""\002"
Displaying Messages in the AutoLISP Developer's Guide.