Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I need a filetovar() function
Message
 
To
27/10/1999 02:16:17
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00282081
Message ID:
00283380
Views:
13
If you have Visual Foxpro 6, filetostr() and strtofile() will do that.

Or for vfp5, you can try something like this:
* Read a file to a string
Function FileToStr5
  LParam pcFilename
  Local lcRetstr, lnfhand, lnsize
  lcRetstr = Space(0)
  If File(pcFilename)
      lnfhand = fopen(pcFilename)
      If lnfhand != -1
          lnsize = fseek(lnfhand, 0, 2)
          If lnsize>0
              fseek(lnfhand, 0)
              lcRetstr = fread(lnfhand, lnsize)
          Endif
          fclose(lnfhand)
      Endif
  Endif
  Return lcRetstr
EndFunc

* Write a string to a file
Procedure StrToFile5
  LParam pcString, pcFilename
  Local lnfhand
  lnfhand = fcreate(pcFilename)
  If lnfhand != -1
      fwrite(lnfhand, pcString)
      fclose(lnfhand)
  Endif
EndProc
>Does anyone know how I can read the contents of an ascii text file into a memory variable so that I can manipulate and parse the data and then put it back into an ascii text file again... I have seen such a function out on the Internet a long time ago but now that I need it I can't seem to find it.
>
>Thanks,
>Daron
>list@teleport.com

Just an opinion... Not a fact.
Previous
Reply
Map
View

Click here to load this message in the networking platform