• MaxScript用二进制读取方式获取Max文件版本


    代码
    Fn GetMaxFileVersion theMaxFile =
    (
    local versionFloat,theBinStream,keyWord,notFind,textFromBin,binEnd
    versionFloat
    = 0
    if isMaxFile theMaxFile do
    (
    theBinStream
    = fopen theMaxFile "r"
    keyWord
    = "Version:"
    notFind
    = true
    textFromBin
    = ""
    fseek theBinStream
    0 #seek_end
    binEnd
    = ftell theBinStream
    fseek theBinStream
    0 #seek_set

    while (ftell theBinStream < binEnd ) and notFind do
    (
    textFromBin
    = ReadString theBinStream
    if textFromBin == "V" do
    (
    for i = 1 to keyWord.Count - 1 do textFromBin += ReadString theBinStream as string
    )
    if keyWord == textFromBin do
    (
    versionString
    = ""
    for i = 1 to 5 do versionString += ReadString theBinStream as string
    versionFloat
    = versionString as float
    notFind
    = false
    )
    )
    FClose theBinStream
    )
    versionFloat
    )

    GetMaxFileVersion(getOpenFileName())
  • 相关阅读:
    指针与数组名
    c语言指针函数与函数指针
    c语言结构体
    c语言
    c语言全局变量
    c语言函数传递数组
    c实例_挑战程序竞赛,蚂蚁
    c语言字符串实例
    安又琪-唱得响亮
    乡村爱情
  • 原文地址:https://www.cnblogs.com/sitt/p/1806515.html
Copyright © 2020-2023  润新知