×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Paul.Thieme@xxxxxxxxxxxxxxxxx wrote:
...
Everything works fine. My problem is I don't understand what
%str(%addr(d_name)) is doing and why it is needed.
Walking through the program in debug, I noticed that d_name has a value. I
changed the code to the "easier on the eyes" version which is simply taking
a 256 char field and truncating it in a 120 char field.
...
Paul, readdir() returns a null-terminated string in d_name. The x'00'
character is the null-terminator. In the debugger (see below), this
character looks like a blank, but you can see it in the hex output if
you use
eval d_name:x
The %STR builtin function looks for the null-terminator and ignores
everything after it.
It looks like both %STR and %SUBST are equally valid ways of handling
the output of readdir. (Assuming that it's impossible for a directory
name to be longer than 639.)
In this debugger session, you can see the '00' in the second line of the
hex listing for d_name:x
> EVAL d_name
D_NAME =
....5...10...15...20...25...30...
1 '/home/mydir/a.txt
> EVAL d_name:x
00000 61889694 856194A8 848999...
00010 A3004040 40404040 404040...
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.