hi expert,

first of all, i have to say sorry for my poor english.i am working on a phone-book project and come across a big problem.

my approach:
1. i ask to users to identify the type of data he would like to search,eg, name, tel no

2. i ask the users to input the searching target

3.i try to read a string of array from file

4. i try to 'separate' the array to get the type of data for searching
ie. grace 22222222 F e-mail@yahoo.com
if the users want to search by e-mail, then i should store the e-mail from the array into a new array and then compare it with the target input. but there is where things go wrong. i ve declared a variable to count the null space(eg, e-mail is after 3 null spaces). the data i want is between two null spaces but i cant get them!!!! can anyone please help me??????????

i know my english is a bit confusing, hope u understand what i mean.

try to use record!

Type
   newtypeR = Record
                  name:string;
                  phone:longint;
                  mail:string;
            End;

And then you can define an array like

Var myarray:Array[1..10] Of newtypeR;
{so every element of the array is a record that has three separate fields}

so when you want to add new member to the phone book you can reference with one record like

Write('Name: ');
ReadLn(myarray[1].Name);
Write('Phone: ');
ReadLn(myarray[1].Phone);
Write('E-Mail: ');
ReadLn(myarray[1].Mail);

Now you want to write this data into a file.The file must be a typed file as 'newtypeR'

Var myarray:Array[1..10] Of newtypeR;
      F:File Of newtypeR;

ok you can store records to this file named F
If you want more then respond

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.