Code: char pRead(int f) { FILE *fp;//local pointer of type file int i; char ch; fp= fopen("mytest.txt", "r"); for (i = 0; (ch = getc(fp)) != EOF && i < 5; i++) { if (i==f) return ch; } } the error is : Error 2 error C2371: 'pRead' : redefinition; different basic types c:\protocolsc\p1.c 53 suppose that the argument i sent(f) is from this code Code: void sender1(void) { frame s; packet buffer; char readArray[4]; int i, j; for (j=0; j<5; j++) { readArray[j]= pRead(j); //need to fill the array by calling pRead character by character } while (true) { for (i=0; i<=5; i++) { buffer.data[i]=readArray[i]; //need to fill the array that a read above in a buffer of typedef (typedef struct {unsigned char data[MAX_PKT];} packet;) } .... } }