Greetings,
Code:
#include "stdafx.h"#include "codificador.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int generaTransformacion(char * original, char * codigo) {
int originalSize;
if (original != NULL) {
/* We obtain dinamically the size of the char */
originalSize = strlen(original);
/* Given that C does only pass by reference an array, we make a copy of it */
char *originalDuplicado = (char *)malloc(originalSize * sizeof(char));
strcpy_s(originalDuplicado, original);
/* By this point, I should be able to check whether the string was copied sucessfully */
return strcmp(originalDuplicado, original);
}
}
In this code, I've got an error in the next line
Code:
strcpy_s(originalDuplicado, original);
in which the compiler, VS C++ 2017, complains about a non-existent overload instance method that matches the arguments (char *, char *)
I know the compiler is complaining of not giving in the argument valid pointers of chars but as far as I know, I'm giving exactly those:
Code:
int generaTransformacion(char * original, char * codigo) {
Code:
char *originalDuplicado = (char *)malloc(originalSize * sizeof(char));
I'm confused with the fact that both lines of code does not represent at least to the function strcpy_s valid char pointers.
Any help or hint would be greatly appreciated.