forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to undestand whar Read is complaining about

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
colt1954



Joined: 21 Dec 2010
Posts: 81

PostPosted: Thu Mar 24, 2011 4:23 pm    Post subject: How to undestand whar Read is complaining about Reply with quote

I am trying to read a data file, some lines I need to miss out etc, the programe on execute comes back with error 52 invalid character in field with error message below. But it does not give the code line number that I recognize where its complaining, I did try the step into approach but it just comes up with similar error codes etc plus other listing that that I do not understand etc...

00401000 MAIN [+179d]

Any ideas how to better get to the bottom of such problems...if only it would tell me the line number the read error occurs, like it does when the compiler complains.
Back to top
View user's profile Send private message
brucebowler
Guest





PostPosted: Thu Mar 24, 2011 5:48 pm    Post subject: Reply with quote

A semi painful/brute force way would be to write out the data after you read it. If there are multiple places you read the file, it also helps to write out some indication of which read it is.
Back to top
mecej4



Joined: 31 Oct 2006
Posts: 1886

PostPosted: Fri Mar 25, 2011 12:20 am    Post subject: Re: How to undestand whar Read is complaining about Reply with quote

To obtain line number information upon program abort, you have to enable it by compiling and linking with /debug or other debug options. You can also set up /debug as a default option, if you wish.

Please read the documentation in the help files.
Back to top
View user's profile Send private message
colt1954



Joined: 21 Dec 2010
Posts: 81

PostPosted: Fri Mar 25, 2011 9:34 am    Post subject: Re: Reply with quote

brucebowler wrote:
A semi painful/brute force way would be to write out the data after you read it. If there are multiple places you read the file, it also helps to write out some indication of which read it is.


Bruce I always do this, its the only way I can develop a program...trouble is its bombing out without writing out anything since it perhaps does not even reach that far.
Back to top
View user's profile Send private message
colt1954



Joined: 21 Dec 2010
Posts: 81

PostPosted: Fri Mar 25, 2011 9:36 am    Post subject: Re: How to undestand whar Read is complaining about Reply with quote

mecej4 wrote:
To obtain line number information upon program abort, you have to enable it by compiling and linking with /debug or other debug options. You can also set up /debug as a default option, if you wish.

Please read the documentation in the help files.


If I understand you correctly I do of course compile with debug etc...it compiles and links ok hence it runs...its after that the read problems start as I tried to indicate in my first post...maybe I have misunderstood you?
Back to top
View user's profile Send private message
brucebowler
Guest





PostPosted: Fri Mar 25, 2011 1:01 pm    Post subject: Re: Reply with quote

BEEFHEART wrote:
brucebowler wrote:
A semi painful/brute force way would be to write out the data after you read it. If there are multiple places you read the file, it also helps to write out some indication of which read it is.


Bruce I always do this, its the only way I can develop a program...trouble is its bombing out without writing out anything since it perhaps does not even reach that far.


In that case, I'd say it's bombing on the very first read.
Back to top
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Fri Mar 25, 2011 1:07 pm    Post subject: Re: How to undestand whar Read is complaining about Reply with quote

BEEFHEART wrote:
Any ideas how to better get to the bottom of such problems

Remember there are standard keyword arguments that can be used in READ statements to assist graceful recovery from error conditions.
Back to top
View user's profile Send private message Send e-mail
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Fri Mar 25, 2011 7:22 pm    Post subject: Reply with quote

You could try reading each line of data as character string and then do an internal read on the string, writing each string to the screen before the internal read.
_________________
John Horspool
Roshaz Software Ltd.
Gloucestershire
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat Mar 26, 2011 10:40 am    Post subject: Reply with quote

Bruce may well be right that it is the very first read that is the problem.

Quite possibly, your data file contains an invisible character that is invalid in the context. The first time I faced this was getting on for 30 years ago, when my word-processor (Wordstar) had a "non-document" mode (OK for Fortran) and a "document" mode that wasn't.

What you have to do is to read that line of data into (say) a CHARACTER array or variable. That must work, as all characters are valid in this format. If you print it out, you will just get an invisible character again - you'll never see it. However, if you print the numerical value of each character, getting it by using ICHAR, then you will be able to print out the number.

From memory, the invisible characters are most of the ones numbered less than 32. From memory I can't remember if 127 or greater is a problem too.

If your datafile was written unformatted and you try to read it with formats, you will also be in trouble. It is possible you have the problem right the way through your file, or it could be simply one character at the start, or somewhere in between.

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group