home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / pascal / 5050 < prev    next >
Encoding:
Text File  |  1992-08-25  |  1.3 KB  |  35 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!orca!javelin.sim.es.com!tpehrson
  3. From: tpehrson@javelin.sim.es.com (tim clinkenpeel)
  4. Subject: Re: want to help me make my 'value' routine crash-proof?
  5. Message-ID: <1992Aug25.210836.908@javelin.sim.es.com>
  6. Reply-To: tpehrson@javelin.sim.es.com
  7. Organization: Evans & Sutherland Computer Corporation
  8. References: <1992Aug25.150516.17385@javelin.sim.es.com> <dmurdoch.65.714760154@mast.queensu.ca> <1992Aug25.191036.21639@javelin.sim.es.com> <dmurdoch.66.714772006@mast.queensu.ca>
  9. Date: Tue, 25 Aug 1992 21:08:36 GMT
  10. Lines: 23
  11.  
  12. dmurdoch@mast.queensu.ca (Duncan Murdoch) writes:
  13. >function value(s:string):word;
  14. >var
  15. >  v : word;
  16. >  error : integer;
  17. >begin
  18. >  val(s,v,error);
  19. >  if error <> 0 then
  20. >    value := 65535
  21. >  else
  22. >    value := v;
  23. >end;
  24.  
  25. my routine is similar to this already, but crashes hard on the val() call.  i
  26. want to know how to avoid this.
  27.  
  28. i want to convert the string '123' to the value 123, not something like
  29. 'one-hundred twenty three'.
  30. -- 
  31. \clinkenpeel: aberrant analytical cynical agnostic idealist.  i exclusively /
  32. /represent myself.  i do not offend anyone; however, some morons choose to  \
  33. \offend themselves.  judge only those who you would have judge yourself.  i /
  34. /don't practice what i preach - i'm not the type of person i'm preaching to.\
  35.