[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] EOF i Windows




Emil Zeuthen skriver:
> 
> Goddag
> 
> Jeg har et meget underligt problem i et C++ program jeg sysler med for
> tiden. Programet kigger bl.a. en fil igennem som skitseret her:
> 
>   signed long int c = 0;        // 4 byte stor i Win
>   ifstream finput(input, ios::in);
> 
>   while (1)
>   {
> 
>     c = finput.get();
> 
>     if (c==EOF)
>     {
>       .....
>       .....
>     }
>     else
>     {
>       ...
>       ...
>     }
>   }
> 
> Det skulle der vidst ikke være noget galt med, hvilket der heller ikke er
> når jeg oversætter koden under Linux. Jeg ved godt dette er en Linux-C liste
> men alligevel drister jeg mig til at spørge: Hvorfor reagerer dette program
> på ASCII-tegn 26 som EOF, når jeg oversætter det i Windåsen? EOF er en int
> (4 byte stor). Jeg tror ikke at det er en compiler-bug, da jeg har prøvet
> med flere forskellige (med samme resultat).

prøv med 
if (c==finput.EOF())


Jeg ville for nok benytte 

While (!finput.eof()) { 
i stedet! 




-- 
-
 MVH
   Kim schulz
========================================================================
|                 ADICT Kode Slave - www.adict.net                     |
|            Dansk Linux Link Database - www.LinuXia.dk                |
========================================================================
              Sleep is just a cheap substitute for coffee     
     Fast, reliable, cheap - pick any two - [Microsoft in a Nutshell]


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *