[plug] C, bad syntax etc.

John Knight anarchist_tomato at hotmail.com
Wed Nov 20 10:37:09 WST 2002


I have a file called 'temp.dat'. The file consists of something like this:
Monday 23
Tuesday 28
Wednesday 31
(etc.)

I have to grab all of those temperatures in the file and display the average 
(it'll be a fixed 7 days, don't worry), so I need to ignore the names and 
just get the temperatures, using only C.

Tah for your help all, makes u feel good to be a geek!

Make lunch, not war.


>
>Or failing that use python ;)
>
>Erm. Not a c guru, but your general form is going to be;
>(pseudocode)
>For each line in file
>{
>       For each character in line
>           {
>              if character in [1..9]
>                  {
>                    Perform some sorta action
>                  }
>           }
>}
>
>Now keep in mind that thats the super unoptimised version.
>The each-character-in-line bit can be done via a searchstring (or 0-9 
>search
>strings if no regexp is available for the task. But that won't necessarily
>help you for whole classes of problem.
>
>What *exactly* is the prob your working on John?
>



_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail



More information about the plug mailing list