Код: Выделить всё
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
char FN[256];
FILE *Z; //file open
int D()
{
while(1)
{
printf("Vvedite imya faila ili exit:\n");
scanf("%s", FN);
if (strcmpi(FN, "exit")==0) return 1;
if ((Z=fopen(FN, "rt"))==NULL)
printf("%s ohibka okritiya\n", FN);
else return 0;
}
}
void P()
{
char b[1], s[250];
int a=0,k=0,f=0,n=0;
while(1)
{
b[0]=fgetc(Z); //perebor elementov v faile
if (feof(Z)) break; //zavershenie perebora
if (ferror(Z)) //coobshenie ob oshibke
{
printf("\n owibka chteniya %s\n", FN);
clearerr(Z); //udalenie info ob oshibke
getch();
break;
}
s[k]=b[0];
n++;
???????????????????
fclose(Z);} //zakritie faila
void main()
{
while(1)
{
clrscr();
int z=D(); //vizov dialoga
if (z==1) exit(0);
else P(); //vizov funk poiska str
getch();
}
}
--------------------------------------------------------------------------------
Добавлено сообщение
--------------------------------------------------------------------------------
задача решена, кому интересно:
Код: Выделить всё
void P()
{
char s[250],*p;
short b;
while(fgets(s,250,Z))
{
p = s;
b = 1;
while(*p)
if(*p>=48 && *p<=57)
{ b = 0; break; }
else p++;
if(b==1) printf("%s",s);
}