|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Oct 2006
Città: milano
Messaggi: 1439
|
[C] ho un bug che non riesco a trovare. penso dovuto a strtok
Ciao a tutti, sono disperato. Ho sto progetto per l'università da portare avanti ma ho un bug che non riesco a risolvere
Dunque, il problema è in questa funzione Codice:
Publication get_publication(char* command)
{
char* parameters, *authorsStr, *idsStr;
Publication p = malloc(sizeof(Publication));
List authors = NULL, ids = NULL;
if(p == NULL)
{
printf("Allocation error\n");
exit(-1);
}
command += 2;
parameters = strtok(command, "|");
p->position = position_from_str_to_int(trim(parameters));
parameters = strtok(NULL, "|");
p->id = trim(parameters);
parameters = strtok(NULL, "|");
p->title = trim(parameters);
authorsStr = strtok(NULL, "|");
idsStr = strtok(NULL, "|");
printf("%s\n", authorsStr);
printf("%s\n", idsStr);
authorsStr = strtok(authorsStr, "&");
while(authorsStr != NULL)
{
authors = add_to_list(authors, trim(authorsStr));
authorsStr = strtok(NULL, "&");
}
p->authors = authors;
idsStr = strtok(idsStr, "&");
while(idsStr != NULL)
{
ids = add_to_list(ids, trim(idsStr));
idsStr = strtok(NULL, "&");
}
p->bibliography = ids;
printf("%s\n", p->authors->value);
printf("%s\n", p->authors->next->value);
printf("%s\n", p->bibliography->value);
printf("%s\n", p->bibliography->next->value);
return p;
}
Il comando che leggo è di questo tipo Codice:
A RI | 1 | the paper | Mario Rossi & Zazza | Giaco mino & Pluto Codice:
Zazza Mario Rossi Pluto Giaco mino Codice:
Zazza QPQ� Pluto Giaco mino |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 02:16.



















