hi
i am trying to read a file and save to array
i wrote one and it worked accept it not reading ot line by line, so i wrote another one but i am trying to make it as function
when i make function call i get this error
read.c:32:13: error: invalid operands to binary * (have ‘char *’ and ‘char *’)
the function should take char* so whats the problem ?
my code
#include <stdio.h>
Nstring *readLine(FILE *file)
{
char buffer[1000];
char * Nstring ;
char *line ;
numstring *result = [ numstring strc:256];
int chars;
do
{
if(fscanf(file, "%4095[^\n]%n%*c", buffer, &chars) == 1)
[res = appendFormat:@"%s", buffer];
else
break;
} while(chars == 1000);
return res;
}
int main (){
char * Nstring ;
char *line ;
FILE *file = fopen("myfile", "r");
// check for NULL
while(!feof(file))
{
Nstring *line = readLine(file);
}
fclose(file);
return 0 ;
}