ข้ามไปยังเนื้อหาหลัก

GW2GetFileTypeID

ทุกประเภทไฟล์มี ID ที่เกี่ยวข้องใน Glasswall Engine API นี้ให้ ID ประเภทไฟล์ของ Glasswall ในรูปแบบสตริงสำหรับนามสกุลไฟล์ที่เกี่ยวข้องที่ระบุมา


#include "glasswall.core2.api.h"

int GW2GetFileTypeID(
Session session,
const char *fileType,
size_t *bufferLength,
char **outputBuffer);

พารามิเตอร์

session ID ของ session ตามที่ส่งกลับโดย GW2OpenSession

fileType สตริงที่มีนามสกุลไฟล์ เช่น "bmp".

bufferLength พารามิเตอร์เอาต์พุตซึ่งจะถูกกำหนดค่าเป็นขนาดหน่วยไบต์ของหน่วยความจำที่ outputBuffer ชี้อยู่

outputBuffer พารามิเตอร์เอาต์พุตแบบตัวชี้สตริง ซึ่งจะถูกเติมด้วย file type ID ที่เชื่อมโยงกับนามสกุลที่ระบุ หน่วยความจำที่ใช้โดยตัวชี้นี้ไม่จำเป็นต้องถูก free โดยผู้ใช้

ส่งกลับ

  ส่งกลับจำนวนเต็มที่ระบุว่าการเรียกใช้ฟังก์ชันสำเร็จหรือไม่ ตัวเลขติดลบหมายถึงความล้มเหลว ดูตาราง Return Types สำหรับคำอธิบายของรหัสส่งกลับ หากสำเร็จ outputBuffer จะถูกเติมด้วย file type ID.

ตัวอย่าง


#include "glasswall.core2.api.h"

char *outbuf = NULL;
size_t buflen = 0;

if (GW2OpenSession() < 0)
/* error opening session */
else
{
int status = GW2GetFileTypeID(session, fileType, &buflen, &outbuf);

/* outbuf points to a buffer containing the XML file.
* Either process the data pointed to, or copy the data and process it
* after GW2CloseSession is called
*/

if (GW2CloseSession() < 0)
/* error closing session */
}