Reading a big ASCII ( txt or xml ) file in the PPC

Reading a big ASCII ( txt or xml ) file in the PPC

Post by QWxiZXJ0by » Tue, 24 Oct 2006 23:59:02


I have a 17MB Txt file that I need to Open in the PPC.
The word mobile cant open it. I need to gather the data in the TXT file..
How can I open big ACII files?

TextWriter tw = new StreamWriter("data.txt") <- Like this he needs to open
the whole file and it is a 17MB txt file.

Thanks!

--
Alberto Cardoso
 
 
 

Reading a big ASCII ( txt or xml ) file in the PPC

Post by Daniel Hun » Wed, 25 Oct 2006 00:42:19

Hi

What you need is StreamReader, not StreamWriter.
17MB on a PPC is very much, if not too much.
Reading it will take a long time.
Make sure you read it in small parts!

Daniel

"Alberto Cardoso" < XXXX@XXXXX.COM > schrieb im

 
 
 

Reading a big ASCII ( txt or xml ) file in the PPC

Post by » Wed, 25 Oct 2006 00:46:27

Since you obviously cann never see the entire 17MB at once you need to do
what good desktop readers also do - you need to virtualize it. You open the
file and only read a window of data - enough to display the current screen
and maybe one before and one after. When the user scrolls the window, you
fetch data in the direction they're scrolling (and likewise pitch the data
at the other end to save memory).

Using a memory-mapped file may also help you in this case too - depending on
exactly what you're doing with the file.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com

"Alberto Cardoso" < XXXX@XXXXX.COM > wrote in
 
 
 

Reading a big ASCII ( txt or xml ) file in the PPC

Post by Sm9l » Wed, 15 Nov 2006 00:07:02

Hi Chris,

I've often heard developers talk about reading only a portion of a file or
only retaining part of a file in memory, but I've never seen an example of
how to do it. (I'm a Physics guy developing small apps)

Do you have an example you could post, or could you direct me to a website
that has information about how to do this?

Thanks,
Joe
 
 
 

Reading a big ASCII ( txt or xml ) file in the PPC

Post by » Wed, 15 Nov 2006 04:36:14

Basically you ned to keep a location pointer (offset, line number, etc).
You open the file and then read from that location froward X amount (maybe a
screen worth of lines or bytes). That amount is essentially a cursor. When
the display control gets a scroll event, you open the file, move
forward/back your cursor size, read the data, display it and close. That
way you're really only ever reading part of the file.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com