#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

#define  PORT  10001                  //PORT ADDRESS
#define  HOST  "zeus"                 //HOST
#define  ACKNOWLEDGE_SIZE   100       
#define  MESSAGE_SIZE       28880
int readfits(char *buffer)
{
    FILE *fp;
    int taille = 0;
    int c;
    char *tmp = NULL;
    
    fp = fopen("header.fits", "r");

    if (fp == NULL)
    {
        printf("impossible d'ouvrir le fichier\n");
        return 1;
    }
    
    while ((c = getc(fp)) != EOF)
    {
        *buffer = c;
        buffer++;
        
    }

    return 0;
}
    
    

int main()
{
    char    ack[ACKNOWLEDGE_SIZE];    //FITS HEADER
    int     sd;                       //SOCKET DESCRIPTOR
    struct  sockaddr_in pin;          //BORDEL POUR SOCKET
    struct  hostent     *hp;
    char    message[MESSAGE_SIZE];
    int     received;

    
    //Send a message
    if (readfits(&message[0]) == 0)
    {
        printf("%s", message);
        printf("%d char lus\n", sizeof(message));
        return 0;
    }
    else
    {
        return 1;
    }
}


