wcstoll() ใช้แปลง Wide Character String เป็นจำนวนเต็ม long long ตั้งค่าตัวชี้ไปยังตัวอักษรถัดจากตัวสุดท้ายที่แปลงได้
ไวยากรณ์
long long wcstoll(const wchar_t* str, wchar_t** str_end, int base)
พารามิเตอร์
- str: ตัวชี้ไปยัง Wide String เริ่มต้น
- str_end: ตัวชี้ที่ฟังก์ชันตั้งค่าไปยังตัวอักษรถัดไปหลังตัวสุดท้ายที่แปลงได้
- base: ฐานเลข (0, 2, 3, ..., 36)
ตัวอย่างฐาน 10
wchar_t string1[] = L"777HelloWorld"; wchar_t string2[] = L"565Hello"; wchar_t* End; int base = 10; long long value = wcstoll(string1, &End, base); // value = 777, End = "HelloWorld"
ตัวอย่างฐาน 16
wchar_t string1[] = L"5EHelloWorld"; // 5E hex = 94 dec wchar_t string2[] = L"125Hello"; // 125 hex = 293 dec int base = 16; // ผลลัพธ์: 94 และ 293