Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #5871 > unrolled thread

Memoread not working

Started byRob van Erk <erk.v@hotmail.com>
First post2013-09-28 01:49 -0700
Last post2013-09-30 15:14 -0400
Articles 10 — 7 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Memoread not working Rob van Erk <erk.v@hotmail.com> - 2013-09-28 01:49 -0700
    Re: Memoread not working BGeorge <GeorgeTritsos@yahoo.gr> - 2013-09-28 02:55 -0700
    Re: Memoread not working malcolm gray <malcolm.gray@ntlworld.com> - 2013-09-28 14:46 +0100
    Re: Memoread not working Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-09-28 21:33 +0200
      Re: Memoread not working Rob van Erk <erk.v@hotmail.com> - 2013-09-29 12:51 -0700
        Re: Memoread not working Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-09-29 22:59 +0200
    Re: Memoread not working Karl Wochele <kw@e©os-system.dot.de> - 2013-09-30 08:48 +0200
      Re: Memoread not working Frans Wauters <info@wautersit.com> - 2013-09-30 02:06 -0700
    Re: Memoread not working Rob van Erk <erk.v@hotmail.com> - 2013-09-30 11:10 -0700
    Re: Memoread not working "Jamal" <jamal@examples.net> - 2013-09-30 15:14 -0400

#5871 — Memoread not working

FromRob van Erk <erk.v@hotmail.com>
Date2013-09-28 01:49 -0700
SubjectMemoread not working
Message-ID<3b14a2d6-d414-41a6-bed5-6dabde6dbcd1@googlegroups.com>
I use following simple code but no idea why it does not read the TXT file:

local cString as string
If (cString := MemoRead("c:\readme.txt")) = null_string
   Errorbox("error", "can not read file")
endif 

The "readme.txt" is not read-only, it does exist, it has a text in it, the user has all rights on c:\ root. No idea why the file is not read by the code. I also tried to open other files like "c:\doc.csv"

Using VO2.8 SP2.

Thanks for any tips...
Rob

[toc] | [next] | [standalone]


#5872

FromBGeorge <GeorgeTritsos@yahoo.gr>
Date2013-09-28 02:55 -0700
Message-ID<e5881944-6a1f-4260-99f4-fd37810a7341@googlegroups.com>
In reply to#5871
Try this:
local cString as string
cString:=MemoRead("c:\readme.txt")
if cString = Null_string
  Errorbox("error", "can not read file") 
endif

George

[toc] | [prev] | [next] | [standalone]


#5873

Frommalcolm gray <malcolm.gray@ntlworld.com>
Date2013-09-28 14:46 +0100
Message-ID<D4B1u.2713$je2.572@fx14.am4>
In reply to#5871
On 28/09/2013 09:49, Rob van Erk wrote:
> I use following simple code but no idea why it does not read the TXT file:
>
> local cString as string
> If (cString := MemoRead("c:\readme.txt")) = null_string
>     Errorbox("error", "can not read file")
> endif
>
> The "readme.txt" is not read-only, it does exist, it has a text in it, the user has all rights on c:\ root. No idea why the file is not read by the code. I also tried to open other files like "c:\doc.csv"
>
> Using VO2.8 SP2.

I am not by development bx just now - does they help say anything about 
setting FERROR or anything like that?

The other thing I would typically do is use a tool like process monitor 
to see what was actually going on.

AHh - also what is in cString at the end - has the single equals 
confused matters?

[toc] | [prev] | [next] | [standalone]


#5874

FromKarl Faller <mail_withoutthat_@_drei-f_andthat_.de>
Date2013-09-28 21:33 +0200
Message-ID<jlbe495t7ebbkhgdbbj2uive7nn59l348f@4ax.com>
In reply to#5871
Rob,

>the user has all rights on c:\ root. No idea why the file is not read by the code. I also tried to open other files like "c:\doc.csv"
just to exclude: does it work on e.g. "D:\readme.txt" ? And if yes,
does it on e.g. "C:\testdir\readme.txt" ?

Karl

[toc] | [prev] | [next] | [standalone]


#5875

FromRob van Erk <erk.v@hotmail.com>
Date2013-09-29 12:51 -0700
Message-ID<9825783b-fe59-4141-b3c9-a2b566e5c7ac@googlegroups.com>
In reply to#5874
Using a different file does not matter. Still not able to read a .txt or .csv file. I get the impression that I may need to allocate some memory before I will be able to use memoread. I also reindexed the VO database. I have found an alternative solution by just using Fopen2, freadline, etc. I am just opening the same file with Fopen without any problems. I will check if there are some sample files and if I have same problems with memoread using the sample .aef.

Anyhow, thanks for all the suggestions given.

Rob

[toc] | [prev] | [next] | [standalone]


#5876

FromKarl Faller <mail_withoutthat_@_drei-f_andthat_.de>
Date2013-09-29 22:59 +0200
Message-ID<en4h491u28jhvne4en7kjrnptjivvrolp8@4ax.com>
In reply to#5875
Rob,
i didn't suggest another file, but suspected the location.
 Redoing your sample, as in the help, i saw the same result. Moved it
to D:\ - again no go.

BUT: after changing code to display cString regardless of the If
clause - i got the content!

So, Memoread works, but it does return Null_String also when there was
no problem with the file...

HTH
Karl

func Start()
LOCAL cString, cFile as STRING
cFile:= "c:\readme.txt"
 If(cString := MemoRead(cFile)) = null_string
         ? "Error reading " + cFile
       ? "NetError", NetErr()
? cString   // content is there!
 else
 	? "OK", cString
 endif
WAIT
return nil


>Using a different file does not matter. Still not able to read a .txt or .csv file. I get the impression that I may need to allocate some memory before I will be able to use memoread. I also reindexed the VO database. I have found an alternative solution by just using Fopen2, freadline, etc. I am just opening the same file with Fopen without any problems. I will check if there are some sample files and if I have same problems with memoread using the sample .aef.
>
>Anyhow, thanks for all the suggestions given.
>
>Rob

[toc] | [prev] | [next] | [standalone]


#5878

FromKarl Wochele <kw@e©os-system.dot.de>
Date2013-09-30 08:48 +0200
Message-ID<basl62Felf5U1@mid.individual.net>
In reply to#5871
Hi Rob,

your mistake is the "="-Operator.

"X"="" -> True
""="X" -> False
"X"==""-> False

So you have to use memoread()==NULL_STRING or NULL_String=memoread()

HTH
Karl

Am 28.09.2013 10:49, schrieb Rob van Erk:
> I use following simple code but no idea why it does not read the TXT file:
>
> local cString as string
> If (cString := MemoRead("c:\readme.txt")) = null_string
>     Errorbox("error", "can not read file")
> endif
>
> The "readme.txt" is not read-only, it does exist, it has a text in it, the user has all rights on c:\ root. No idea why the file is not read by the code. I also tried to open other files like "c:\doc.csv"
>
> Using VO2.8 SP2.
>
> Thanks for any tips...
> Rob
>

[toc] | [prev] | [next] | [standalone]


#5879

FromFrans Wauters <info@wautersit.com>
Date2013-09-30 02:06 -0700
Message-ID<3c39e48d-7b5a-4b6d-9317-c0f099099c6e@googlegroups.com>
In reply to#5878
Hi Rob,

I NEVER use the = operator. I only use the == and the := operator.

  ==   for (exact) testing
  :=   for assigning a value/object
  =    is (in my eyes) only usefull for compatibility reasons

Try to avoid one-liners like these (I know, for some this is a sport):

  If (cString := MemoRead("c:\readme.txt")) = null_string 

Write like this makes it more readable and more easier to debug:

  cString := MemoRead( "c:\readme.txt" )
  IF cString == NULL_STRING


One-liners are usualy not good pickup lines too:)

Regards,
FRans

[toc] | [prev] | [next] | [standalone]


#5881

FromRob van Erk <erk.v@hotmail.com>
Date2013-09-30 11:10 -0700
Message-ID<28b5ca13-16fc-4b06-8777-797dbe1eaa28@googlegroups.com>
In reply to#5871
Thanks for your support. It was indeed the "=" causing the problem. I tested out with "==" and all works fine now. 

Learning all the time in the VO forum group :-)

[toc] | [prev] | [next] | [standalone]


#5883

From"Jamal" <jamal@examples.net>
Date2013-09-30 15:14 -0400
Message-ID<l2ciiu$9jk$1@speranza.aioe.org>
In reply to#5871
Rob,

What you should is to add a call to SetExact(TRUE) in your application start 
method avoid such surprises in other areas of your code. Unfortunately, VO 
has the default set to FALSE which made you suffer for a few days <g>.

This will ensure that all string comparisons use ==  (exactly equal by 
length and value) instead of = ( which causes strings to be compared by 
length and position only)

HTH,
Jamal

"Rob van Erk"  wrote in message 
news:3b14a2d6-d414-41a6-bed5-6dabde6dbcd1@googlegroups.com...

I use following simple code but no idea why it does not read the TXT file:

local cString as string
If (cString := MemoRead("c:\readme.txt")) = null_string
   Errorbox("error", "can not read file")
endif

The "readme.txt" is not read-only, it does exist, it has a text in it, the 
user has all rights on c:\ root. No idea why the file is not read by the 
code. I also tried to open other files like "c:\doc.csv"

Using VO2.8 SP2.

Thanks for any tips...
Rob 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web