• Not writting the varable to the file

    From Phil@VERT/PLT2 to All on Thursday, November 19, 2009 09:28:50
    This is not writting the information to the file.

    !INCLUDE ERRNO.INC
    !INCLUDE FILE_IO.INC
    !INCLUDE DIR_ATTR.INC
    !INCLUDE USERDEFS.INC
    !INCLUDE NODEDEFS.INC
    !INCLUDE SBBSDEFS.INC

    ########################## Example
    #COMPARE_ARS FLAG "4G"
    #IF_TRUE
    #print "The flag is set ok\r\n"
    #end_if
    #PAUSE
    ########################## END OF EXAMPLE


    #### START OF THE PROGRAM

    INT F1 F2 F3 F4 # File handler
    INT SL # Users Security Level
    STR USERNAME # Users Name
    str info1 # dummy varable read a line from the file
    # printf "Username Online is: \%s" USERNAME
    copy username _useron.name
    copy sl _useron.level # Get the users security level
    goto test
    compare_ars level 20 # Check and see if the user has security level 50 if_false
    goto end
    end_if
    fopen f1 o_rdonly "%!upgraded.txt"
    feof f1
    if_true
    fclose f1
    goto adduser
    end_if
    fread_line f1 info1 # Read from the file
    compare f1 username # Compare the username with whats in the file.
    If_true # Found a match/ Do not add the user name to the file
    goto no1
    else # Add the user to upgraded.txt
    fclose f1 # Close file/ Re-Open it as write
    :test
    fopen f1 O_RDWR|O_CREAT "%!upgraded.txt" # Open the file as append.
    printf "\%s" UserName
    printf "\r\n"
    fset_pos f1 0 seek_end
    truncsp username
    fwrite f1 username 40
    fprintf f1 "%s" username
    fflush f1
    fclose f1
    goto end
    end_if


    :adduser

    :no1 # User is already in the upgraded.txt file/ do not add him
    fclose f1
    goto end

    :end
    pause









    ---
    þ Synchronet þ bbs.cyberchatnet.com - 192.168.1.102