>hi everyone,
>
>what is the problem of following code? i can open and get the values, but can't write the new value back to the file:
>
>there is only 5 bytes in Number.dat: " 1234".
>
>FileID=fopen("Number.dat")
>if FileID <> -1 then
> tempStr=fgets(FileID, 40)
> tempNum=val(tempStr)
> tempStr=padl(allt(str(tempNum+1)), 5, " ")
> fwrite(FileID, tempStr)
>endif
>
>
>I have tried fwrite(FileID, "tempStr") and fwrite(FileID, &tempStr), both not work.
>
>thanks in advance!
fopen defaults to open for read-only, use fopen("Number.dat", 2 ) for buffered read/write or fopen("Number.dat", 12 ) for unbuffered read/write.
Len Speed