473,386 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Interact with console application

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 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).

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.

Thanks for any help,

Oliver
Aug 21 '08 #1
2 1883
On Thu, 21 Aug 2008 06:04:01 -0700 (PDT), Oliver Witt <ol******@googlemail.comwrote:
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!
Aug 21 '08 #2
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.
popen() is what I have been looking for. Thank you.
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.
UTF8 works fine, UTF16 is the problem. I believe I will just convert
UTF-16 to UTF-8.

Oliver
Aug 21 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
9
by: Tommy Lu | last post by:
Hi, wondering if there is a way to interact the shell command with the C# program? For example, if I type c:\>ver it then suppose to return the version of the OS I am currently using... or ...
6
by: Ian Frawley | last post by:
Hello everyone I have written a Windows Service to monitor local and remote Processes/Applications. However I am stuck because if it is installed as a user account I cannot get it to interact...
10
by: Steve | last post by:
I want to make a web application that will run on my home server and would like to be able to have the web application interact with another, winforms application. For example, let's say I wanted...
1
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.