M
Magix
Hi,
I have following in my data file:
<12345><Benjamin><Single>
<4567><Stephen><Married>
<8383245><George><Married>
I want to write a function that display according to the line number given
(Max line number is 5), without the '<' and '>'
Example:
DisplayInfo(1) will display:-
12345 Benjamin
Single
DisplayInfo(2) will display:-
4567 Stephen
Married
.... and so on.
#define LINE_SIZE 100;
static char buffer[LINE_SIZE];
void DisplayInfo(int linenum)
{
//... file open here, if error, return.
while(fgets(buffer, sizeof(buffer), fp)!=NULL)
{
// check for line number
}
fclose(fp);
}
Any hints/tips will be great. Thanks.
I have following in my data file:
<12345><Benjamin><Single>
<4567><Stephen><Married>
<8383245><George><Married>
I want to write a function that display according to the line number given
(Max line number is 5), without the '<' and '>'
Example:
DisplayInfo(1) will display:-
12345 Benjamin
Single
DisplayInfo(2) will display:-
4567 Stephen
Married
.... and so on.
#define LINE_SIZE 100;
static char buffer[LINE_SIZE];
void DisplayInfo(int linenum)
{
//... file open here, if error, return.
while(fgets(buffer, sizeof(buffer), fp)!=NULL)
{
// check for line number
}
fclose(fp);
}
Any hints/tips will be great. Thanks.