Is there any way of measuring the width of a VerbatimInput block?
In other words, I would like something along the following lines, except that the verbatim data should be taken from an external file as with \VerbatimInput:
\documentclass{article}
\usepackage{fancyvrb}
\begin{document}
% Get the verbatim data from an external file instead.
\SaveVerb{data}+verbatim text }&^+
\newlength{\mylength}
\settowidth{\mylength}{\UseVerb{data}}
Width is: \the\mylength.
\end{document}
(Saving the verbatim block is not crucial to me so if there is some completely different way of measuring its width that would also be fine. I also don't insist on using the \fancyvrb package if there is another verbatim package that does this.)