nan19 de Enero del 2003
Pregunta
Hola, me han mandado un programa en clase que escriba una frase en un archivo txt, y que luego pida el nombre del fichero donde ha sido guardado. Me han dicho que es muy fácil pero yo no se como hacerlo. Agradeceria mucho si alguien pudiese ayudarme.
To?on19 de Enero del 2003
Es un estracto. espero que te ayude. (síguelo en Wath mode)
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#define MAX 100
int REGI[16]={0}, x=0, i=0, a=0, l=6, j=-1, pk, k=45;
char TIPTOK, COM, T[12], *INST, *t;
char TOKN[7], *CMD, *REGC, *temp, LINE[40];
char *PTK=0, INSTR[MAX][MAX]; unsigned int PK;
void FLAGBIT(void), SALIDA(void), RugoNum(void), ActRug(void);
int chkline(int *LIN), CHKTOK(void), TMP=0;
FILE *PF=0;
void main(void)
{
clrscr();
while (!feof (stdin)) {
strset(LINE,' ');l++;if(l==19) l=7;
fflush(stdin);
gotoxy(10,l); clreol(); printf("");
scanf("%[^n]",LINE);
PK = 0; INST = LINE; PTK = LINE;
strset(TOKN,' ');
temp = strrchr(PTK,' ');
strupr(PTK); x=-1;
while ( (PTK != temp) && (TIPTOK != 'a') && (!feof(stdin)) ) {
j++; x++;
if (TIPTOK == 'a') { COM = 0; gotoxy(30,l);
printf("ᎎ ERROR: Checar Sintaxis..."); }
else TOKN[x]=TIPTOK;} TIPTOK = ' ';
if((!strcmp(TOKN,"x1x3x2x6")) || (!strcmp(TOKN,"x1x3x2x3")))
if ((PF=fopen ("USER.LEN","w+"))==NULL)
{textcolor(12);gotoxy(20,2);
cprintf("IMPOSIBLE CARGAR ARCHIVO USER.LEN n");textcolor(14);}
else
// fprintf(++PF, "%s",INST);
fwrite(LINE, strlen(LINE), 1, PF);
} fclose(PF);
} /// FINAL ///