473,320 Members | 1,930 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,320 software developers and data experts.

How do you read this?

Hello,

I have a small project and it's hard to understand what the requirements
are.
Basically I need to read a text file and identify titles and attributes with
their values.
I have to remove leading and trailing spaces in the titles and attribute
lines. That is OK as
I found a way of using only stringbuilder objects.
But I find it difficult to understand the following:
The class should support:
- Get an integer value associated with a given title and attribute names.
- Set an integer value for a given title and attribute names, writing the
new file to disk.

Here is the structure of the input file.

<title1>
attribute1:value1
attribute2:value2

<title2>
attribute3:value3
attribute4:value4
attribute5:value5
attribute6:value6

I created a class GetText which has a method for parsing the text:
ParseText. It reads a whole line and after processing it, it writes to the
output file.
GetText myParser;
myParser.ParseText();

But I do not understand the purpose of the Get and Set in this context.

Thanks
May 23 '06 #1
3 1786
The requirements leads to the following functions:

- Get an integer value associated with a given title and attribute names

public int GetIntValue(string Title, string attribute); //return the int
value of attribute

- Set an integer value for a given title and attribute names, writing the
new file to disk.
public bool SetIntValue(string Title, string attribute, int valuetoSet)

"Dan Aldean" wrote:
Hello,

I have a small project and it's hard to understand what the requirements
are.
Basically I need to read a text file and identify titles and attributes with
their values.
I have to remove leading and trailing spaces in the titles and attribute
lines. That is OK as
I found a way of using only stringbuilder objects.
But I find it difficult to understand the following:
The class should support:
- Get an integer value associated with a given title and attribute names.
- Set an integer value for a given title and attribute names, writing the
new file to disk.

Here is the structure of the input file.

<title1>
attribute1:value1
attribute2:value2

<title2>
attribute3:value3
attribute4:value4
attribute5:value5
attribute6:value6

I created a class GetText which has a method for parsing the text:
ParseText. It reads a whole line and after processing it, it writes to the
output file.
GetText myParser;
myParser.ParseText();

But I do not understand the purpose of the Get and Set in this context.

Thanks

May 24 '06 #2
pls specify whether my post is helpful for you.

"Dan Aldean" wrote:
Hello,

I have a small project and it's hard to understand what the requirements
are.
Basically I need to read a text file and identify titles and attributes with
their values.
I have to remove leading and trailing spaces in the titles and attribute
lines. That is OK as
I found a way of using only stringbuilder objects.
But I find it difficult to understand the following:
The class should support:
- Get an integer value associated with a given title and attribute names.
- Set an integer value for a given title and attribute names, writing the
new file to disk.

Here is the structure of the input file.

<title1>
attribute1:value1
attribute2:value2

<title2>
attribute3:value3
attribute4:value4
attribute5:value5
attribute6:value6

I created a class GetText which has a method for parsing the text:
ParseText. It reads a whole line and after processing it, it writes to the
output file.
GetText myParser;
myParser.ParseText();

But I do not understand the purpose of the Get and Set in this context.

Thanks

May 24 '06 #3
Hi Altaf, thanks for the reply.
I would read the "get an integer... and set an integer..." as GET and SET
used for building properties.
But even not using properties, I understand setting an integer value for a
title and writing it on disk.
But why getting the integer associated with a title? The file is not a
database to retrieve the title based on a number.
And the class is supposed to be a parser, not a retriever. It says: build a
class that can parse the input file.

"Altaf Al-Amin Najwani" <al**********@gmail.com> wrote in message
news:4A**********************************@microsof t.com...
The requirements leads to the following functions:

- Get an integer value associated with a given title and attribute names

public int GetIntValue(string Title, string attribute); //return the int
value of attribute

- Set an integer value for a given title and attribute names, writing the
new file to disk.


public bool SetIntValue(string Title, string attribute, int valuetoSet)

"Dan Aldean" wrote:
Hello,

I have a small project and it's hard to understand what the requirements
are.
Basically I need to read a text file and identify titles and attributes
with
their values.
I have to remove leading and trailing spaces in the titles and attribute
lines. That is OK as
I found a way of using only stringbuilder objects.
But I find it difficult to understand the following:
The class should support:
- Get an integer value associated with a given title and attribute names.
- Set an integer value for a given title and attribute names, writing the
new file to disk.

Here is the structure of the input file.

<title1>
attribute1:value1
attribute2:value2

<title2>
attribute3:value3
attribute4:value4
attribute5:value5
attribute6:value6

I created a class GetText which has a method for parsing the text:
ParseText. It reads a whole line and after processing it, it writes to
the
output file.
GetText myParser;
myParser.ParseText();

But I do not understand the purpose of the Get and Set in this context.

Thanks

May 24 '06 #4

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

Similar topics

10
by: Yang Li Ke | last post by:
Hi guys! I have some datas that I must check everytime a visitor comes to my site What is better to do: 1- Read data from a file or 2- Read data from a mysql db Thank you
7
by: KantKwitDansin1 | last post by:
I have a file "a.dat" containing 10^4 32 bit binary numbers. I need to read in these numbers and deterimine if they are prime. The primality part I will have to figure out later, but I was...
2
by: Andrea Bauer | last post by:
Hallo, wie kann ich so eine Datei unter .Net schreiben C++ oder C#. Bitte mit Funktionsaufrufen. Vielen Dank. Grüße Andrea <Product> <ProgramNumber>2</ProgramNumber>
6
by: Rolf Schroedter | last post by:
(Sorry for cross-posting). I need to access large files > 2GByte (Linux, WinXP/NTFS) using the standard C-library calls. Till today I thought I know how to do it, namely for Win32: Use open(),...
3
by: collinm | last post by:
hi i send a command to a led display, the led display is suppose to return me some character i write a string on a serial port void ledDisplayExist() { char msg={'\0', '\0', '\0', '\0',...
3
by: Madhu | last post by:
Hi, I need to trap EAGAIN error while using read(). I read in some website that read() has to wait till write() is completed for EAGAIN to occur. But read() doesnt seem to wait, it reads...
2
by: Marc Ouellette | last post by:
Hi Everyone, I am currently reading Binary files in C++Builder using the code below. Removed some error chacking to make the code simpler to read. std::ifstream fin;...
23
by: asit dhal | last post by:
hello friends, can anyone explain me how to use read() write() function in C. and also how to read a file from disk and show it on the monitor using onlu read(), write() function ??????
2
by: Jack | last post by:
Hi, I want to read a string a chars from a stream, and put it into a string. At the moment, I'm creating a buffer of a fixed size, and reading the stream of text into it. It works, but I have...
3
by: gert | last post by:
what is the difference between iter(lambda:f.read(8192), ') and iter(f.read(8192),'') ?
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.