Hi all
I have just had to write some code to run on a Windows box. I wrote the code on a linux machine where it ran fine and then compiled under Windows. It compiled and ran but errored out. The problem turned out to be theFileStr() function which on Linux seemed to cope with fair sized files (certainly up to 160K) whereas under Windows (XP) it seemed to have a limit (from memory about 30K).
I programmed around this using FOpen(), FRead() and a pre-allocated buffer, but I was wondering if anyone else had struck this problem?
Regards
Doug
FileStr()
- xProgrammer
- Posts: 464
- Joined: Tue May 16, 2006 7:47 am
- Location: Australia
FileStr()
Last edited by xProgrammer on Wed Apr 01, 2009 11:52 am, edited 1 time in total.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: StrFile()
Hi Doug,
Nice to see you again here
What parameters are you using to call StrFile() ?
Nice to see you again here
What parameters are you using to call StrFile() ?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: StrFile()
You can also use MemoWrit() to save a string to a file.
Its easier than using FCreate(), etc.
Its easier than using FCreate(), etc.
- xProgrammer
- Posts: 464
- Joined: Tue May 16, 2006 7:47 am
- Location: Australia
Re: FileStr()
OOps! I meant FileStr() NOT StrFile()!
I was just calling as follows:
FileData := FileStr( FileName )
That is I omitted parameter 2 (nBytes) so it should read the entire file (and does so under Linux) but under Windows seems to only read the first 30K or so.
Sorry about mixing up FileStr() and StrFile().
Regards
Doug
I was just calling as follows:
FileData := FileStr( FileName )
That is I omitted parameter 2 (nBytes) so it should read the entire file (and does so under Linux) but under Windows seems to only read the first 30K or so.
Sorry about mixing up FileStr() and StrFile().
Regards
Doug
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: FileStr()
This sample works fine here:
EMG
Code: Select all
FUNCTION MAIN()
LOCAL cBuf := FILESTR( "TEST.EXE" )
? LEN( cBuf )
INKEY( 0 )
RETURN NIL
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: FileStr()
I guess that code is equivalent to:
local cText := MemoRead( "test.exe" )
local cText := MemoRead( "test.exe" )