Version with nul termination option