how to get a value from input txtfile

int main()
{
string line;
int i,ch;

printf("\nEnter Length of Page-reference :");
scanf("%d",&n);


// printf("\nEnter sequence: "); keyin method

//from txtfile
ifstream myfile ("string.txt");
while (getline (myfile,line))
{
cout << line << endl;
}

//im stuck here... how to pass the string to this function?

for(i=0;i<n;i++) //accepting sequence
scanf("%d",&pg[i]);
do
{
printf("\n\tMENU\n");
printf("\n1)FIFO");
printf("\n2)LRU");
printf("\n3)Exit");
printf("\nEnter your choice:");
scanf("%d",&ch);
switch(ch)
{
case 1: fifo();
break;

case 2: lru();
break;

}
}while(ch!=3);
getchar();

}
Hi Linabahar,

it's not clear what you are trying to do.
So it is very difficult to offer any help,

can you explain what you are working on?

Thanks -NGangst




Topic archived. No new replies allowed.