Add nullcpy()
Invented function to memcpy() with a specific size, but add a null terminator.
This commit is contained in:
parent
0d65f188f0
commit
eadca3d25b
@ -12,4 +12,7 @@ extern "C"
|
||||
usize wcslen(const wchar_t* str);
|
||||
|
||||
char* strdup(const char* str);
|
||||
|
||||
// Copies len bytes from src into dest and adds a null terminator.
|
||||
void nullcpy(char* dest, const char* src, usize len);
|
||||
}
|
@ -65,4 +65,10 @@ extern "C"
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
void nullcpy(char* dest, const char* src, usize len)
|
||||
{
|
||||
memcpy(dest, src, len);
|
||||
dest[len] = 0;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user