Skip to content

Instantly share code, notes, and snippets.

@JiaChangGit
JiaChangGit / io_TermInput.cpp
Created April 24, 2024 04:12
111-cpp_io- io_TermInput
#include <cxxabi.h> //abi::__cxa_demangle
#include <iostream>
#include <sstream>
#include <string>
#include <typeinfo>
#include <vector>
template <typename T>
class IOProcessor {
@JiaChangGit
JiaChangGit / io_FileInput.cpp
Created April 24, 2024 04:11
111-cpp_io-io_FileInput
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
enum class ErrorCode {
SUCCESS,
FILE_OPEN_FAILED,
FILE_WRITE_FAILED,
@JiaChangGit
JiaChangGit / ifstreamTest.cpp
Created April 24, 2024 04:09
111-cpp_io-ifstreamTest
#include <fstream>
#include <iostream>
using namespace std;
int main() {
ifstream in1;
in1.open("ifstreamTest1.txt");
if (in1.fail()) {
cout << "file opening is failed...\n";
exit(1);
}
@JiaChangGit
JiaChangGit / README.md
Created April 24, 2024 04:08
111-cpp_io-README

111-cpp_io

Project Tree

cpp_str                  //
├─ copyFile.c            //
├─ copyFile.exe          //
├─ ifstreamTest.cpp      //
├─ ifstreamTest1.txt //
Title Author Date
檔案管理系統
Jia
24/04/23

000-General

010-Waiting

100-Code

@JiaChangGit
JiaChangGit / copyFile.c
Last active April 24, 2024 04:06
121-c_io-copyFile
#include <stdio.h>
static int copyfile(const char *src_name, const char *tar_name) {
char buffer[8192];
size_t read = 0;
if (!src_name || !tar_name) return -1;
FILE *src_file = fopen(src_name, "rb");
if (src_file == NULL) {
@JiaChangGit
JiaChangGit / ub.md
Created April 5, 2024 16:41
Linux command

ulimit -s 81920

C/C++ trap

int* p1, p2; 可能以為 p2 也是指標,但事實上並不是

#define pow(a) a * a

展開後會是 x + x * x + x

改成#define pow(a) (a) * (a)

@JiaChangGit
JiaChangGit / BinarySearchTree.cpp
Last active July 5, 2024 01:49
c/c++ code snippet
#include <algorithm>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
template <typename T>
class IOProcessor {
@JiaChangGit
JiaChangGit / Microsoft.PowerShell_profile.ps1
Created April 4, 2024 08:46
WindowsPowerShell/Microsoft.PowerShell_profile.ps1
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = [Text.UTF8Encoding]::UTF8