- Joined
- Mar 15, 2009
- Messages
- 1
- Reaction score
- 0
Hello. My name is Martin. I was wondering if someone could please help me out. The problem is that when i compile this function i get an error message saying the following:
In Function handle_delete:
p6-server.c:184: error: incompatible types in assignment
p6-server.c:185: error: incompatible types in assignment
p6-server.c:186: error: incompatible types in assignment
This is my program:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include "net.h"
#include "p6.h"
#define MAX_MESSAGES 10
#define MAX_USERS 10
struct message {
char from[STR_LEN];
char date[STR_LEN];
char message[MSG_LEN];
};
struct user {
char name[STR_LEN];
int num_msgs;
struct message messages[MAX_MESSAGES];
};
/ * removed funtioncs */
void handle_delete(CONNECTION_ID connection, struct user users[], int num_users) {
char leuser[MSG_LEN];
int i,j, nowmesg;
char Get[MSG_LEN];
printf("in handle delete\n");
read_string(connection, leuser, MSG_LEN - 1);
i = Locate (users, num_users, Get);
/*Number of messages of Ith user*/
nowmesg = users.num_msgs;
read_string(connection, Get, MSG_LEN - 1);
strcpy(users.messages[nowmesg].from, Get);
for (j = 0; j <= nowmesg; j++) {
line 184 users.messages[j].message = '\0';
line 185 users.messages[j].from = '\0';
line 186 users.messages[j].date = '\0';
}
}
any suggestions??
In Function handle_delete:
p6-server.c:184: error: incompatible types in assignment
p6-server.c:185: error: incompatible types in assignment
p6-server.c:186: error: incompatible types in assignment
This is my program:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include "net.h"
#include "p6.h"
#define MAX_MESSAGES 10
#define MAX_USERS 10
struct message {
char from[STR_LEN];
char date[STR_LEN];
char message[MSG_LEN];
};
struct user {
char name[STR_LEN];
int num_msgs;
struct message messages[MAX_MESSAGES];
};
/ * removed funtioncs */
void handle_delete(CONNECTION_ID connection, struct user users[], int num_users) {
char leuser[MSG_LEN];
int i,j, nowmesg;
char Get[MSG_LEN];
printf("in handle delete\n");
read_string(connection, leuser, MSG_LEN - 1);
i = Locate (users, num_users, Get);
/*Number of messages of Ith user*/
nowmesg = users.num_msgs;
read_string(connection, Get, MSG_LEN - 1);
strcpy(users.messages[nowmesg].from, Get);
for (j = 0; j <= nowmesg; j++) {
line 184 users.messages[j].message = '\0';
line 185 users.messages[j].from = '\0';
line 186 users.messages[j].date = '\0';
}
}
any suggestions??
Last edited: