DTEDITORSETCONTENTSFROMFILE(3)

πŸ“¦
version 2.5.3 Β· 2 versions
, in nixos 26.05

πŸ’– DtEditorSetContentsFromFile(3) πŸ’–

okay so bestie, this page is from the library call manual section β€” manual name nestled in near the top, no crusty repeated header line. It's all about DtEditorSetContentsFromFile, and it is literally giving "load a file straight into a DtEditor widget." ✨

🌸 NAME 🌸

DtEditorSetContentsFromFile β€” load data from a file into a DtEditor widget. πŸŽ€

✨ SYNOPSIS ✨

#include &<Dt/Editor.h>
DtEditorErrorCode DtEditorSetContentsFromFile(
Widget widget,
char *fileName);

πŸ’… DESCRIPTION πŸ’…

The DtEditorSetContentsFromFile function loads the contents of a file into a DtEditor widget. 🫢

⚠️ bestie, heads up: any data currently in the DtEditor widget is lost. Not hidden, not merged β€” gone. πŸ’€

After the data is loaded, the insertion cursor is positioned at the first character. 🎯

The widget argument specifies the DtEditor widget ID. The fileName argument is the pathname of the file relative to the local system. πŸ—‚οΈ

For a complete definition of the DtEditor widget and its associated resources, see DtEditor(3). πŸ‘‘

πŸŽ€ RETURN VALUE πŸŽ€

Upon successful completion, the DtEditorSetContentsFromFile function returns one of the following values when it successfully loads the data into the DtEditor widget: πŸ’–

  • DtEDITOR_NO_ERRORS β€” the file is readable and writable. βœ…
  • DtEDITOR_READ_ONLY_FILE β€” the file is read only. πŸ™ˆ
  • DtEDITOR_NULLS_REMOVED β€” the file contained embedded NULL characters, which were removed. 🧹

Otherwise, if it cannot load the data into the DtEditor widget, the function returns one of the following values: 😭

  • DtEDITOR_NONEXISTENT_FILE β€” the file does not exist. 🫠
  • DtEDITOR_DIRECTORY β€” the file is a directory. πŸ“
  • DtEDITOR_CHAR_SPECIAL_FILE β€” the file is a character-special device. πŸ”Œ
  • DtEDITOR_BLOCK_MODE_FILE β€” the file is a block-mode device. 🧱
  • DtEDITOR_NO_FILE_ACCESS β€” the file cannot be accessed. 🚫
  • DtEDITOR_INSUFFICIENT_MEMORY β€” not enough system memory is available to load the file. 🧠πŸ’₯
  • DtEDITOR_UNREADABLE_FILE β€” the file is unreadable for an unspecified reason. ❓

πŸ¦‹ APPLICATION USAGE πŸ¦‹

If the data is in memory, rather than a disk file, the application should use DtEditorSetContents(3). 🧚

🌈 SEE ALSO 🌈

Dt/Editor.h - DtEditor(5), DtEditor(3), DtEditorAppend(3),
DtEditorAppendFromFile(3), DtEditorGetContents(3), DtEditorInsert(3),
DtEditorInsertFromFile(3), DtEditorReplace(3),
DtEditorReplaceFromFile(3), DtEditorSaveContentsToFile(3),
DtEditorSetContents(3).

that's the whole page, bestie 🫢 β€” source: library call; version/date: not listed in the original footer, so no fake date energy here. πŸ’…

πŸ“¦ where this page comes from