请教一下 定义uint 的问题
麻烦前辈给详细解释一下在这个文本文件的创建中,定义的unit uiPos=0,在此的作用是什么,谢谢。#include <stdio.h>
#include <stdlib.h>
typedef unsigned int uint;
#define CHAR_FILE "characters.txt"
#define BIN_FILE "numbers.txt"
#define OUTPUT_FILE "out.txt"
int main()
{
FILE *pCharsF, *pNumsF, *pOutF;
uint uiPos = 0;
printf("This program will read the characters from \"%s\"\n and the numbers from \"%s\"\n",CHAR_FILE, BIN_FILE);
printf("Then the program will put the characters corresponding to 1 in \"%s\" with their position\n", OUTPUT_FILE);
pCharsF = fopen(CHAR_FILE,"r");
if(pCharsF == NULL)
{
printf("Error: file \"%s\" could not be found!\n", CHAR_FILE);
exit(0);
}
pNumsF = fopen(BIN_FILE,"r");
if(pNumsF == NULL)
{
printf("Error: file \"%s\" could not be found!\n", BIN_FILE);
exit(0);
}
pOutF = fopen(OUTPUT_FILE, "w");
if(pOutF == NULL)
{
printf("Error: file \"%s\" could not be found!\n", OUTPUT_FILE);
exit(0);
}
uiPos = 1;
while(1)
{
char chNum, chTmp;
chNum = fgetc(pNumsF);
if(chNum == '.' || chNum == EOF)
break;
chTmp = fgetc(pCharsF);
if(chTmp == '.' || chTmp == EOF)
break;
if(chNum == '1')
fprintf(pOutF, "%c%d",chTmp, uiPos);
uiPos++;
}
fclose(pOutF);
fclose(pNumsF);
fclose(pCharsF);
return 0;
}