edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] pst
@ 2014-01-27 22:18 Karl Dahlke
  0 siblings, 0 replies; only message in thread
From: Karl Dahlke @ 2014-01-27 22:18 UTC (permalink / raw)
  To: Edbrowse-dev

As we take some steps towards c++,
you notice I use the type pst,
which is a typedef in eb.h,
which is suppose to remind you of a perl string.
This is evolution.
Remember that edbrowse version 1 was written in perl,
and is still available.
A perl string is nice for many reasons but one is that it can hold \0.
Null does not end the string.
So each line of a file is held in a perl string, and if the line has nulls in it,
like when you download a binary file, that's ok.
When I moved from perl to C I had to reconstruct all this,
and have my own "strings",
like perl strings, that would work for me.
In this case I use newline as the end character, not \0.
So that's what pst is all about.

Well I just did a check with strings in c++ and they are perl style strings,
so that's good, and will make things easy.
This snippit of code shows, keeping both hello and world in s.

string s;
s = "hello";
s += '\0';
s += "world";
cout << s.size();
cout << s << endl;

You probably knew all this anyways but I like to figure things
out by playing with it.

Karl Dahlke

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-01-27 22:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-27 22:18 [Edbrowse-dev] pst Karl Dahlke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).