# (write-char character \[file-descriptor\]) [GstarCAD 2012](../../../Index.md) → [Developer Reference](../../%28Developer%20Reference%29.md) → [AutoLISP Reference](../%28AutoLISP%20Reference%29.md) → [LISP Functions](%28LISP%20Functions%29.md) <a id="309"></a> ## (write-char character \[file-descriptor\]) --- Write that character to a file. --- This function write a character to a file. The file is specified by the *file-descriptor*, assigned by the [open](%28open%20filename%20mode%29.md) function. This function writes characters that are in ASCII code. You convert a letter to its ASCII code with the (equal statement1 statement2 \[tolerance\])(IDR\_166)(ascii string)(IDR\_128) function. When the *file-descriptor* is left out, the *character* is written to the command line and Prompt History window. **NOTE** The [write-line](%28write-line%20string%20-file-descriptor-%29.md), function, whose format argument is a *string,* is often more practical and efficient to use than the write-char function. **Example** | Code | Returns | Prints in File | | --- | --- | --- | | (setq fil (open "sample.lsp" "w")) (**write-char** (ascii "b") fil)) | 98 | b | **Tell me about...** [(chr integer)](%28chr%20integer%29.md) [(read-char \[file-descriptor\])](%28read-char%20-file-descriptor-%29.md) [(write-line string \[file-descriptor\])](%28write-line%20string%20-file-descriptor-%29.md) [LISP Compatibility](../LISP%20Compatibility.md) [Programming Overview of LISP (LISt Processing) Language](../Programming%20Overview%20of%20LISP%20%28LISt%20Processing%29%20Language.md) <a id="holding"></a> ## Other versions with matching text [GstarCAD 2011](../../../../2011/Developer%20Reference/AutoLISP%20Reference/LISP%20Functions/%28write-char%20character%20-file-descriptor-%29.md)