c언어 문자만 추출부분 에러 좀 봐주세요

redfoxkiller의 이미지

#include
#include
#include
#include

#define TOKEN_LEN 10
#define MAX_LINES 100

void main()
{
FILE *fp;
char line[512];

char input[MAX_LINES*3][ TOKEN_LEN];
char output[MAX_LINES*3][ TOKEN_LEN];
// char output2[MAX_LINES*3][ TOKEN_LEN];
char tmp_out[MAX_LINES*3][ TOKEN_LEN],tmp_in[MAX_LINES*3][ TOKEN_LEN];

char *pstr;
int i=0, count, index=0;
int k=0;
int asc;
//char asc;

fp=fopen( "number.txt","rw");

if(fp == NULL)

{

printf("file opening error\n");

return;

}

while( fgets(line,sizeof(line),fp) )
{

if( strcmp( line, "\n" )==0 )
continue;


pstr=strtok(line,"=");

while(pstr !=NULL)
{

strcpy(output[i], pstr);
strcpy(tmp_out[i], pstr);
pstr = strtok(NULL, "=");
strcpy(input[i], pstr);
strcpy(tmp_in[i], pstr);
pstr = strtok(NULL, "=");
//printf( " %s" , tmp_in[i] );
i++;

}

}
for(k=0; k
asc=tmp_in[k];

if((asc>64) && (asc<123))
{
if((((asc>64) && (asc<90))) || ((asc>96) && (asc<123)))
{

printf("%s", asc);

}
}
}


/*

for(k=0; k<5; k++) // ASC 코드 범위로 특수문자, 숫자를 제거한다.
{

if((tmp_out[k]>64) && (tmp_out[k]<123))
{
if((((tmp_out[k]>64) && (tmp_out[k]<90))) || ((tmp_out[k]>96) && (tmp_out[k]<123)))
{
output2

    = tmp_out[k];
    index += 1;
    // printf("%c\n", tmp2[i]);
    }
    }
    }
    */
    printf( " output\t intput\n");
    count = i;
    for( i = 0; i < count; i++ )
    printf( " %s\t %s" , output[i],input[i] );
    printf( " \n");
    fclose(fp);
    }

    ===================================================================================================================

    a = 3.5
    b = 4.3
    c = a + b
    d = a + b
    e = c + d

    이파일을 받아서 '='기준으로 토큰을 나누는 어서 인풋 아웃풋에 저장 하는 프로그램입니다. 우선에 '='기준으로 인풋 아웃풋 저장까지는 했습니다. 오른쪽 인풋 부분을 다시 문자만 {a b} {c d} 만 출력 하려고 하는데 잘 안되고 있습니다. 밑에 부분이 숫자, 특수문자만 걸러내는 문법인데 3.5, 4.3 a+b a+b c+d 그대로 출력이 됩니다. 잘못된 부분을 좀 알려주시면 감사하겠습니다.

    for(k=0; k
    asc=tmp_in[k];

    if((asc>64) && (asc<123))
    {
    if((((asc>64) && (asc<90))) || ((asc>96) && (asc<123)))
    {

    printf("%s", asc);

    }
    }
    }

    File attachments: 
    첨부파일 크기
    Package icon texttoken.zip1.01 KB