Reading file from .txt file to a srting variable !!!

hey people can someone please tell me how to read a .txt file and put it into a string file ??

Please Help me

this somewhat i tried to check
It isn't working this way !
It very Urget I can't find any other way out

______________________________________________________________
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<fstream.h>
#include<stdio.h>

void main()
{
const int MAX=50;
char buffer[MAX],code[10000];
clrscr();

cout<<"\n\n\n\n\nEnter the string to";
ifstream infile("text.txt");
while(infile)
{
infile.getline(buffer,MAX);
strcat(code,buffer);
}
puts(code);
getch[/code]();

}
______________________________________________________________
Topic archived. No new replies allowed.