Files
Tools_CPP/lib/mem.cpp
2024-11-01 12:23:13 +05:00

36 lines
1.1 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
============================================================================
Name : mem.cpp
Author : irigm@mail.ru
Version :
Copyright : Your copyright notice
Description : Для работы с паматью и со строками в памяти
============================================================================
*/
//------------------------------------------------------------------------------
//Копировать первую строку во вторую
void strcat2( char * destptr, const char * srcptr )
{
int pos1=strLen2(destptr); //Позиция 0ля первой строки
int pos2=strLen2(srcptr); //Позиция 0ля втрой строки
for(int i=0;i<pos2;i++)
{
destptr[pos1+i]=srcptr[i];
}
}
//------------------------------------------------------------------------------
//Длина строки до 0ля
int strLen2(char * str)
{
int result=0;
for(int i=0;i<255;i++) //Позиция 0ля первой строки
{
if(str[i]==0){
result=i;
break;
}
}
return result;
}