Low level

Q:
A need create a temporary file to use while the session is live and set a text field with this name to use macro on web client.
The command file=Lianja.evaluate(‘tmpnam()’) work on appbuilder, but not on webclient.
In fact a need create a POS.
So I am using catalogView to show items and I need create a grid with items to be saved on table.
But gadget grid dont work on web.
A:
Use a regular grid section, and make the header and/or footer invisible, and you can make it look all like one section, etc.
For storage: think JSON, and use SessionStorage



Advertisements

Low level

FSEEK() is actually moving the pointer. If I do the following I get the expected results except that BOF() doesn’t return True even before I move through the file.
Using FGETS(<fd>,0,1) appears to correctly return the current position:

Code:
open database southwind
use customers
copy to xxx.txt type csv
xxx=fopen("xxx.txt")
? xxx
? bof()
? fseek(xxx,0,1)
? fgets(xxx)
? fseek(xxx,0,1)
? fseek(xxx,0,0)
? fseek(xxx,0,1)

The FEOF() flag only gets set/reset after a read operation. As Dave says, the fseek(FileHandle,0,0) is returning you to the start of the file, it’s just that having been set, FEOF() won’t be unset until you do another read operation. Try something like this:

Code:
FileHandle = FOPEN(Lianja.Get("Gamesheet.GSHeader.txtGamesheet").text)

Do While .T.
  cGetline = fgets(FileHandle)
  If FEOF(FileHandle)
    exit
  else
    // process ...
  endif
ENDDO

fseek(FileHandle,0,0)  // Return to start of file

Do While .T.
  cGetline = fgets(FileHandle)
  If FEOF(FileHandle)
    exit
  else
    // process ...
  endif
ENDDO