bnhshallow
Programmer
Hi Everyone.
What I am trying to do in my program is read data from a file and make the program trigger events from the data in the file. The problem I am having is that the fgets() reads a line from the file, but also reads the '\n' or "Enter Mark" at the end of the string. If Possible, How can i get rid of the \n ant the end of the string, or make it so the
if(text=="ENDREADSESSION(Quit)" will see the \n as a charecter
///************Sample Code From File***********///
FILE *txtfile;
char text[1000];
txtfile=fopen(m_sResults,"r"
///////////DIV
if (txtfile)
{
while (!feof(txtfile))
{
fgets(text,300,txtfile); //////Reads Unwanted Newline
if(text=="ENDREADSESSION(Quit)"/////Does not trigger because of newline
{
MessageBox("ENDREADSESSION(Quit)--Quiting WinFunc® .","File Command--#106"
}
There are no errors in the code that MFC is telling me about.
Thanks in advance.BNH
What I am trying to do in my program is read data from a file and make the program trigger events from the data in the file. The problem I am having is that the fgets() reads a line from the file, but also reads the '\n' or "Enter Mark" at the end of the string. If Possible, How can i get rid of the \n ant the end of the string, or make it so the
if(text=="ENDREADSESSION(Quit)" will see the \n as a charecter
///************Sample Code From File***********///
FILE *txtfile;
char text[1000];
txtfile=fopen(m_sResults,"r"
///////////DIV
if (txtfile)
{
while (!feof(txtfile))
{
fgets(text,300,txtfile); //////Reads Unwanted Newline
if(text=="ENDREADSESSION(Quit)"/////Does not trigger because of newline
{
MessageBox("ENDREADSESSION(Quit)--Quiting WinFunc® .","File Command--#106"
}
There are no errors in the code that MFC is telling me about.
Thanks in advance.BNH