Use C++ array for buf