On Thu, 21 Aug 2008 06:04:01 -0700 (PDT), Oliver Witt <> wrote:
> Hi,
>
> I am coding a c++ application that is supposed to be capable of
> altering large text files. I want to use sed to do this.
So you'll use "sed -i ..."; otherwise you cannot alter the files in
place.
> So I need to
> know how I can start sed from within the c++ program and how to get
> the return value (I do not want to write the result immediately into a
> file).
Use the ANSI C system() call. There are similar situations where
you'd rather use popen(), like if you want your C++ code to interpret
sed's output. Windows may have similar calls named Spawn-something.
> This is another question, a little off topic, but if somebody happens
> to know... This program will be running on a Windows machine. I do not
> know how to tell sed if it is dealing with Unicode or Ascii encoded
> files.
Sorry, no. But what Unicode do you mean? There's UTF-8, and then
there are encodings with 16 bits per character and so on. I'm not
familiar with Windows.
/Jorgen
--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.se> R'lyeh wgah'nagl fhtagn!
|