Bom pessoal to com 1 trabalho q tenho q fazer com arquivo em c++, tem que retirar caracter tipo usando o Backpace mais não tenho noção de como fazer alguem me ajuda?
segue a abaixo a proposta e 1 pedaço do código.
Novo Arquivo
2 – Abrir Arquivo
3 – Salvar
4 – Sair
OBS: Permitir que o usuário edite o arquivo, acrescentado e/ou retirando
caracteres.
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define ESC 27
#define F2 -60
#define F3 -61
#define F4 -62
void gotoxy(int coluna, int linha)
{
COORD point;
point.X = coluna; point.Y = linha;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), point);
}
int main () {
FILE *pFile;
char s[100];
int ch = 0;
gotoxy(0,20);
printf("F2 - Novo\t");
printf("F3 - Abrir Arquivo\t");
printf("F4 - Salvar\t");
printf("ESC - Sair\t");
ch = getch();
gotoxy(0,0);
while(ch != ESC)
{
if (ch == F2) {
if((pFile = fopen("arquivo.txt", "r")) == NULL){
printf("Nao foi possivel abrir o arquivo!!\n\n");
system("pause");
return 0;
}
}
if (ch == F3) {
printf("Abrir Arquivo\n\n");
}
if (ch == F4){
printf("Salvar\n\n");
}
ch = getch();
if(ch == 0){
ch = -getch();
}
}
while (fscanf(pFile, "%s", s) != EOF)
printf("%s\n\n", s);
fclose(pFile);
system("pause");
}