0

I'm creating a program in a symbol ppt2800 PocketPC and we're gonna use it for doing a list of stuff in a store. The barcode reader in the symbol reader will be checked against a list in the PocketPC and if they match it will note it in a list. I'm gonna export a list from our checkout system and I can export it to the following formats:

  • pdf
  • csv
  • crystal report rpt
  • html 3.2 or 4.0
  • xls
  • word rtf
  • postformat rec
  • txt
  • rtf
  • ttx
  • xml.

My question is what format is the easiest one to convert to an array in C#? I need it to work on compact framework 1.1

abatishchev
  • 98,240
  • 88
  • 296
  • 433
  • Wow, that is an OLD device. I suggest finding a different scanner if at all possible. There are plenty of out-of-production devices that you can get cheap that can run Compact Framework 3.5. You should try to get up to at least Window Mobile 5 or Windows CE 5. – tcarvin Aug 13 '12 at 11:47

6 Answers6

2

For a simple list, just text, ideally just a record per line. Anything like PDF, Crystal or Word will need lots of processing - not suitable for pocket PC. For a simple txt file, that is just:

string[] entries = File.ReadAllLines(path);

If that isn't on CF, then just using a StreamReader instead:

List<string> list = new List<string>();
using(StreamReader reader = new StreamReader(path)) {
    string line;
    while((line = reader.ReadLine()) != null) {
        list.Add(line);
    }
}
string[] entries = list.ToArray();

(or ArrayList / CopyTo if you don't have access to generics!)

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
1

If you care about only easiest read into array, I would say, that CSV or TXT file with some predefined by you delimeter could be easiest one.

Just read the text into the string and make fileString.Split(delimeter)

Tigran
  • 61,654
  • 8
  • 86
  • 123
0

XML can be the easiest if you can define the structure and deserialize it directly. If not then it depends on the data, but most probably csv is the simpliest choice IMHO.

Matzi
  • 13,770
  • 4
  • 33
  • 50
0

Given your simple requirements I suggest to use txt, csv or xml.
These formats could be easily read with internal NET classes.
(The System.IO namespace will give plenty of options See this example)

The other formats will require complex specific converters.

Steve
  • 213,761
  • 22
  • 232
  • 286
0

I think XML or CSV file are the most easiest to parse.

You can parse XML with the basics class of the .NET framework, you can parse CSV with CsvHelper.

h1ghfive
  • 196
  • 7
0

you should look into xml , and bin xmlserialization , and binary one