Looking for LP25 Système d'exploitation Linux et programmation système en langage C test answers and solutions? Browse our comprehensive collection of verified answers for LP25 Système d'exploitation Linux et programmation système en langage C at moodle.utbm.fr.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Observez le code ci dessous :
char *f(char *s) {
while (*s != ',')
++s;
return s;
}
Quelles sources de problèmes existent dans ce code (2 réponses correctes) ?
Observez le code ci-dessous :
#define MAX_LEN 4096
/*!
* @brief function make_path concatenates a dirname and a filename to provide a full path to file
* @param path_to string containing the directory of the file (NULL if file is in current dir)
* @param file_name the file basename (shall not be NULL)
* @return a pointer to the full path, allocated by the function and freed by its caller.
*/
char *make_path(char *path_to, char *file_name) {
char *full_path = malloc(sizeof(char) * MAX_LEN);
if (!path_to) {
strcpy(full_path, file_name);
return full_path;
}
if (!file_name)
return NULL;
strcpy(full_path, path_to);
strcat(full_path, "/");
strcat(full_path, file_name);
return full_path;
}
Que va-t-il se passer si la fonction est appelée avec path_to ayant une valeur et file_name étant NULL ?