Hi i am trying to make a little program to execute commands
My problum is when I read in a file for example like the one below
at the end it adds an extra line

Code:
SET A,"Hello World"
PAUSE
Echo A
So this is the code I use to read the above lines

Code:
#include <iostream>
using namespace std;

int main(){
	
	FILE *fp;
	char buffer[50];

	fp = fopen("C:\\out\\test.txt","r");

	if(fp == NULL){
		cout << "Cannot Open Filename\n";
		return 0;
	}

	while(!feof(fp)){
		fgets(buffer,50,fp);
		//Write out each line
		cout << buffer;
	}

	system("pause");
}
After running the code in the console it adds an extra line like below:

Code:
SET A,"Hello World"
PAUSE
Echo A
Echo A <--This is the line it adds
Can someone please help me thanks I am very new to c++ so i guess i am doing something wrong somewere thanks.