server.c
int load_file(const char *filename, char *buffer, int n)
{
    FILE* fp;
    int i;

    fp = fopen(filename, "r");

    if (fp == NULL)
    {
        perror("Load file error");
        return -1;
    }

    for(i = 0; i < n; i++)
    {
        buffer[i] = fgetc(fp);
        if (feof(fp))
        {
            buffer[i] = '\0';
            break;
        }
    }

    fclose(fp);

    return 0;
}
/* Load a file into a buffer, returns -1 on error */
Load a file into a buffer, returns -1 on error
Load a file into a buffer returns - 1 on error
int load_file(const char *filename, char *buffer, int n)
{
    FILE* fp;
    int i;
    fp = fopen(filename, "r");
    if (fp == NULL)
    {
        perror("Load file error");
        return -1;
    }
    for(i = 0; i < n; i++)
    {
        buffer[i] = fgetc(fp);
        if (feof(fp))
        {
            buffer[i] = '\0';
            break;
        }
    }
    fclose(fp);
    return 0;
}
int load_file ( const char * filename , char * buffer , int n ) { FILE * fp ; int i ; fp = fopen ( filename , " " ) ; if ( fp == NULL ) { perror ( " " ) ; return -1 ; } for ( i = 0 ; i < n ; i ++ ) { buffer [ i ] = fgetc ( fp ) ; if ( feof ( fp ) ) { buffer [ i ] = ' \0 ' ; break ; } } fclose ( fp ) ; return 0 ; }
Load a file into a buffer, returns -1 on error
Load a file into a buffer returns - 1 on error