473,792 Members | 2,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to upgrade config file

Hi All,
I have a config file as followings

[SERVER_DETAILS]
IP_ADDR=1.2.3.4
PORT=1290

[CLIENT_DETAILS]
IP_ADDR=1.2.3.5
PORT=1291

,etc now my requirement is to write a C++ program which can add a new
entry in the config file, delete existing entry from config file and
modify value of existing entry from the config file
Is there any easy way of solving this?

Regards,
Chinmoy

Aug 17 '05 #1
2 1668
* Chinmoy Mukherjee:
I have a config file as followings

[SERVER_DETAILS]
IP_ADDR=1.2.3.4
PORT=1290

[CLIENT_DETAILS]
IP_ADDR=1.2.3.5
PORT=1291

,etc now my requirement is to write a C++ program which can add a new
entry in the config file, delete existing entry from config file and
modify value of existing entry from the config file
Is there any easy way of solving this?


Question the requirement. Use a script language. Or, for C++, use the
platform's usual API for updating such config files.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Aug 17 '05 #2

Alf P. Steinbach wrote:
* Chinmoy Mukherjee:
I have a config file as followings

[SERVER_DETAILS]
IP_ADDR=1.2.3.4
PORT=1290

[CLIENT_DETAILS]
IP_ADDR=1.2.3.5
PORT=1291

,etc now my requirement is to write a C++ program which can add a new
entry in the config file, delete existing entry from config file and
modify value of existing entry from the config file
Is there any easy way of solving this?


Question the requirement.


LOL. That's exactly what some people I work with do, when they're lazy
and don't want to write code.

Their are times when requirements need to be questioned. But on this
newsgroup the topic is the C++ language ( and not system design or
software engineering where requirements should be reviewed closely )
The question was "Is there any easy way of solving this ( assuming in
C++ )"? Avoiding the answer by suggesting changing the requirements
probably isn't how the OP though C++ experts would handle such a
question.

Here's my answer....
"Easy" is a relative term. It can be done in C++, but most people who
ask such questions probably wouldn't consider it easy. One project
that I work on supports config files similar to yours by defining data
structures to hold the data, it parses the file and fills these data
structures. There is also code to write the data structures back to
file. If your program doesn't need to use any of the info in the config
file, but only needs to change or add a value, you could use a C++
library which supports regular expressions to make the changes you need
to the file.

However, If I were asked to write something to only change the file (
and it wasn't required to be in C++ ), I would choose perl instead of
C++.

-Brian

Aug 17 '05 #3

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

Similar topics

1
6934
by: max | last post by:
RDBMS Version:: 10.1.0.3.0 Operating System and Version:: MAC OS X 10.4.2 Product Version:: ORACLE Db10g Version 10.1.0.3.0 OEM Console Operating System and Version:: I cannot install emca anymore on my database which runs o.k. emca -x dataqual I did erase the enterprisemanager and tried to reinstall it again.
2
1330
by: timp | last post by:
HI We are currently considering to upgrade to .net 2.0 but we are in the middle of a release face, and I need to here you experience wither other n- tier solutions based on ASP.Net and some Infragistic web grids etc. Did you have any issues with the upgrade ? and what issues ? Regards Tim P
6
2082
by: Joseph Geretz | last post by:
I recently upgraded my server to Windows 2003. The first thing I noticed is that my sample WebService pages no longer worked. The Invoke test button is missing. This is addresed by the following KB article: Microsoft Knowledge Base Article - 819267 INFO: HTTP GET and HTTP POST Are Disabled by Default http://support.microsoft.com/default.aspx?scid=kb;en-us;819267 The article advises that a new block be inserted into Web.config (or into
4
1961
by: MadCrazyNewbie | last post by:
Hey Group, I have a VB6 Project im trying to use with VB.Net, It lets me open it and the Upgrade Wizard Launches I click next Select EXE and Click Next Again, the it errors with: "Upgrade Failed: Exception Error Occurred: Invalid System Configuration (Unable to Locate Micorosoft.VisualBasic.UpgradeExtensions.dll. Please re-run Setup and try again."
1
2032
by: Troy Jerkins | last post by:
WSS V2, SP2 running on Win Svr 2003, SP1. I've just upgraded from .NET 1.1 to 2.0. I have multiple virtual server sites on this server using host headers with the same IP. I changed all my sites from .NET v1.1 to v2.0 and ran the stsadm command listed below. stsadm.exe -o upgrade -forceupgrade which makes changes to the web.config file for each site referenced by this
3
1094
by: Don | last post by:
I've done a little reading and haven't come across any clean solution for the subject. Does anyone have any ideas on how to achieve the same. Requirements- - Upgrade existing ASP.NET applications - distribute only modified files - if files have been modified at client side (then they may need to be left as they are). Eg Config file.
0
1781
by: logic0 | last post by:
I am tryn to upgrade apache from 2.0.47 and following steps i got it from apache site Downloaded new binaries from apache for 2.0.55 and go to new downloaded directory and Run The Configuration File ./config.nice Run The Make File make Run The Install Make File
1
2620
by: Joel Fireman | last post by:
Help Needed: Upgrade Fedora 4 / Apache 2 to PHP 5.2.x from 5.0.4 I've been testing Joomla as a content manager for the County offices, and it looks pretty good. Unfortunately, I decided to upgrade it from the 1.0.13 version to 1.5 as we get ready to go live with the web site... and the update installation gives an error in XML processing, which seems (from what I've been able to dredge up in forum discussions) to stem from a known bug in...
3
6824
by: Bob Altman | last post by:
Hi all, In my VB 2005 project I create a setting called UpgradeRequired with a default value of True, and I include the following code that runs when the project is launched: If My.Settings.UpgradeRequired Then My.Settings.Upgrade() My.Settings.UpgradeRequired = False My.Settings.Save()
0
9670
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9033
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.