jed-users mailing list

[2016 Date Index] [2016 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [jed-users] How to search for ASCII 0 ?


Ulli Horlacher <framstag@xxxxxxxxxxxxxxxxxxxx> wrote:
> I have 300 MB text file with some lines containing ASCII 0 (\000)
>
> How can I search for them?

Although jed can edit/read/write such files, many functions are limited
to the use of C strings, which are \0 terminated.  These include the
search/replace functions as well as intrinsic functions such as
bufsubstr.

Here is a function designed specifically to search for ASCII 0 in the
current buffer.

define search_ascii_0 ()
{
   variable m = create_user_mark ();
   do
     {
        variable p = _get_point();
        push_mark ();
        eol ();
        if (_get_point() != p + strbytelen(bufsubstr()))
          {
             _set_point (p);
             while (not(eolp()))
               {
                  if (0 == what_char ())
                    break;
                  go_right(1);
               }
             return;
          }
     }
   while (down(1));
   goto_user_mark (m);
   message ("Not found");
}

--John
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.


[2016 date index] [2016 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]