A Long is a data type that holds an integer value but occupies more memory (8 bytes on a 64-bit machine) than the (Short) Integer data type. It is equivalent to a 64-bit Integer -
this will give a better insight. When you use the
atoi function, this truncates the string to the size of a 32-bit integer and so you lose some information.
Maybe the following will help - it will retrieve the Entity name of the entity referenced by the Field (which could then be converted to a VLA-Object if specifically required).
(defun Field->Entity ( en )
(cond
(
(and
(wcmatch (cdr (assoc 0 (setq en (entget en)))) "TEXT,MTEXT,ATTRIB")
(setq en (cdr (assoc 360 en)))
(setq en (dictsearch en "ACAD_FIELD"))
(setq en (dictsearch (cdr (assoc -1 en)) "TEXT"))
(setq en (cdr (assoc 360 en)))
(setq en (cdr (assoc 331 (entget en))))
)
en
)
)
)
Supply it with the Ename of the entity containing the field (MText, Text, Attrib).