Hi there!
I'm presented with the following situation:
I'm writing a server program that receives information and saves it to
a structure i've created that goes by the name of tabela.
The entire program has 6 files:
projecto.h
serv.h
servsql.h
linkedlist.c
serv_aux.c
servsql.c // this is were main() is
My issue is, i've declared the structure tabela in the file linkedlist.
I can use the functions defined in linkedlist in servsql (were main
is), but i cannot create a variable of the type tabela there... What is
wrong??? I've searched the web for some tutorial but failed to find any
result. Thanks in advance for any help. Bellow you can see the
beginning of every file.
Regards
Pedro Pinto
------------------------------
projecto.h
------------------------------
#ifndef PROJECTO_H
#define PROJECTO_H
#define BUFFSIZE 6804
#define LENGTH 4
#include <sys/socket.h>
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <sys/time.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#endif
------------------------------
servsql.h
------------------------------
#ifndef SERVSQL
#define SERVSQL
#include "linkedlist .c"
#include "serv_aux.c "
#include "servsql.c"
int main(int argc, char* argv[]);
void syntax();
void checkParameters (int argc);
void checkPort(int porto_servidor) ;
#endif
-----------------------------
serv.h
-----------------------------
#ifndef SERV_H
#define SERV_H
#include "projecto.h "
void syntax();
void checkParameters (int argc);
void checkPort(int porto_servidor) ;
void printMessage(ch ar buff[]);
void trataMsgCreateI nsert(char array[], char result[]);
void trataMsgUpdateS elect(char array[], char result[]);
int criaMensagem(in t id, int cod, char pedido[], char *buffer);
void getPedido(char buf[], char result[]);
int getId(char buf[]);
int getCod(char buf[]);
int getSizeQuery(ch ar buf[]);
------------------------------------
servsql.c
------------------------------------
#include "serv.h"
/* Função Main */
int main (int argc, char *argv[]) {
------------------------------------
serv_aux.c
------------------------------------
#include "serv.h"
------------------------------------
linkedlist.c
------------------------------------
#include "projecto.h "
typedef struct tabela tabela;
struct tabela {
char nome[50];
int nColunas;
int nLinhas;
char nomeColunas[10][50];
char valores[50][10][65];
tabela *next;
};