strcpy — string copying.

Description:

u8 strcpy(u8 *string_1, u8 *string_2)

Copies the string string_2 into the string string_1 and return the target string length.

List of parameters:

string_1

String or pointer to the string where it will be copied to.

string_2

String or pointer to the string which will be copied.

Return values:

Returns the target string size in bytes.

Example:

<item addr="524:248" name="Test for strcpy function" type="script">

		V-ID/V-ADDR 
		{
			if(opt0()) 
			{
				u8 str_1[50] = "first";
				u8 str_2[50] = "second"; 
				
				// example 1
				u8 copyResult_1 = strcpy(&str_1, &str_2); 
				
				// Result output to the interface
				u8 strForMess[100];
				sprintf(strForMess, "%cstr_1: %s (len_1 - %d)", 1, str_1, copyResult_1);
				setStatus(@exciterId():32, &strForMess); 
				
				// example 2
				u8 copyResult_2 = strcpy(&str_2, "third");
				
				// Result output to the interface
				sprintf(strForMess, "%cstr_2: %s (len_2 - %d)", 4, str_2, copyResult_2);
				setStatus(@exciterId():32, &strForMess);
			 }
		}

</item>

The result of performing the example in the interface:

cstr_1: second (len_1 – 6)

cstr_2: third (len_2 – 5)