Results 1 to 8 of 8

Thread: add numbers from a text file

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    78

    add numbers from a text file

    Hi

    How can I add numbers from a text file (and there are only numbers in that txt file), without using IO.File.ReadAllLines

    is there any other method?


    I can't use the above because my code must work on a desktop pc, as well as on a pocket pc.
    and ReadAllLines is not supported in the compact framework for Windows Mobile.

    thanks
    Last edited by HyperUniverse; Jul 25th, 2013 at 10:46 AM.

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: add numbers from a text file

    Hmm. How can I enter a room without opening the door? How can I eat a boiled egg without cracking the shell?
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    78

    Re: add numbers from a text file

    so are you telling me that on a pocket pc there is no way to add the numbers in a text file and display the result on a label?

    you can enter the room via the window
    and you can swallow the whole egg

    I helped you with your problem,
    can you help me with my problem?

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: add numbers from a text file

    No I'm telling you that there's no way to do anything with any kind of file without actually opening it and reading it. If you want a different way of reading a file then there are loads of them but they all amount to the same thing, get values, process values, display result.

    and you can swallow the whole egg
    Well you might be able to .... !

    EDIT:
    and ReadAllLines is not supported in the compact framework for Windows Mobile.
    Might have been useful to lead with that. So what is supported?
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,479

    Re: add numbers from a text file

    what is supported is the most important question here...

  6. #6
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: add numbers from a text file

    Granted attributes but how would a phone read a text file?

    Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows CE Platform Note: Because file systems for devices operate differently, the .NET Compact Framework does not support getting or setting file attributes.

  7. #7
    Frenzied Member MattP's Avatar
    Join Date
    Dec 2008
    Location
    WY
    Posts
    1,227

    Re: add numbers from a text file

    StreamReader is supported in the compact framework. You can use the ReadToEnd method to get a string representation of the file.
    This pattern in common to all great programmers I know: they're not experts in something as much as experts in becoming experts in something.

    The best programming advice I ever got was to spend my entire career becoming educable. And I suggest you do the same.

  8. #8
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,764

    Re: add numbers from a text file

    Have you tried using a StreamReader with .ReadToEnd?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width