Read-only archive of the All About Symbian forum (2001–2013) · About this archive

reading a asciifile with NC 9500 and OPL

3 replies · 1,919 views · Started 08 May 2005

High OPLprogrammers and Commi 9500 users
I want to read a string from an ascii file, my testprogramm ignores the CR LF and reads 255 chars.

Tha Asciifile looks like this:

Aalst;50,933;4,033;Belgium;Brussels;
Aarhus;56,133;10,183;Denmark;Copenhagen;
Abidjan;5,317;-4,033;Ivory Coast;Abidjan;1
�bo Turku;60,5;22,317;Finland;Helsinki;
Abu Dhabi;24,467;54,367;United Arab Emirates;Abu Dhabi;1
Acapulco;16,85;-99,933;Mexico;Mexico City;
Accra;5,583;-0,217;Ghana;Accra;1
....

I want a string like:
"Aalst;50,933;4,033;Belgium;Brussels;"

My Programm does this:
"Aalst;50,933;4,033;Belgium;Brussels;
Aarhus;56,133;10,183;Denmark;Copenhagen;
Abidjan;5,317;-4,033;Ivory Coast;Abidjan;1
�bo"

In the Crytal porting guide is a "convert.ohx" mentioned, I searched the web and couldnt find it.
Do I need this file?

On my Netbook erverything worked aout fine 😊
I hope someone can help me.

Marukusu

The reason your program reads this entire string is that it reads 255 characters. If you need to read until the next CRLF you shouldn't ignore the CRLF. If I'm not mistaking there's an example how to read this kind of file in Appendix A of the porting guide.

You can find convert.opx and convert.oxh in the OPL developer package at http://opl-dev.sourceforge.net/opldev.html

Hope this helps
Arjen

kitebuggy wrote:Hi Marukusu,

I've just been coding a CSV to dbms converter in the last few days. Although your text file isn't quite a csv format, it's close enough to be a simple conversion for an existing program.

You may like to have a look at the post & code here:
http://my-symbian.com/forum/viewtopic.php?t=21664
and here:
http://my-symbian.com/forum/viewtopic.php?t=21678

I hope this helps.

Regards,

Jason.


The code in those topics is really too complex for me.... Me too need to read an ascii file; can somebody post a little snippet of code to accomplish this task?