Created
August 26, 2018 10:08
-
-
Save kobake/72d8f07b6f49ec92969dc0dd8111a3bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
// For specify int | |
template <int N> | |
class Buffer { | |
public: | |
Buffer() { | |
m_buf[0] = 0; | |
} | |
char* Pointer() { | |
return m_buf; | |
} | |
private: | |
char m_buf[N]; | |
}; | |
int main() | |
{ | |
Buffer<100> buf; | |
strcpy(buf.Pointer(), "Hello"); | |
printf("%hs\n", buf.Pointer()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment