The flag will be for checking odd or even line.

Thanks,
Dhana

On Wed, Dec 9, 2009 at 9:42 AM, dhana seelan <[email protected]>wrote:

> Hi ,
>
> Have a flag kind of variable and read each character and check for new line
> '\n' and store alternative lines by using flag in another file.
>
> Thanks,
> Dhana
>
>
> On Tue, Dec 8, 2009 at 1:22 PM, Rafae Ashfaq <[email protected]>wrote:
>
>>
>>
>> simple...!!!!!!!!!!
>>
>> initialize them as array elements and then in tke other function display
>> them using "cout".
>>
>> --- On Tue, 12/8/09, samar aseeri 
>> <[email protected]<samaraseeri%40yahoo.com>>
>> wrote:
>>
>> From: samar aseeri <[email protected] <samaraseeri%40yahoo.com>>
>> Subject: Re: [c-prog] Re: samar
>> To: [email protected] <c-prog%40yahoogroups.com>
>> Date: Tuesday, December 8, 2009, 4:04 AM
>>
>>
>>
>> what I want is if the first file has the following data
>>
>> 1
>> 2
>> 3
>> 4
>> 5
>> 6
>> 7
>> 8
>> 9
>>
>> I want the following data to be copied to the other program
>>
>> 2
>> 4
>> 6
>> 8
>>
>> i.e copy the even lines
>>
>> --- On Tue, 8/12/09, Peter Nilsson <peternilsson42@ yahoo.com> wrote:
>>
>> From: Peter Nilsson <peternilsson42@ yahoo.com>
>> Subject: [c-prog] Re: samar
>> To: c-p...@yahoogroups. com
>> Date: Tuesday, 8 December, 2009, 4:29 AM
>>
>>
>>
>> samar aseeri <samaraseeri@ ...> wrote:
>> Subject: samar
>>
>> Please make your subject line describe the nature of your
>> post. Your name is far from a good description of the content.
>>
>> > the below attached program uses the argument command line
>> > the copy a file to another file. my question is what can I
>> > change in   the program to make only part of the first file
>> > be copied to the second.
>>
>> Before you change the code, you first have to decide what
>> part you want to return. Is it a number of characters, a
>> a number of words, a numbr of lines, only every third
>> palindrome, ... what?
>>
>> > #include<stdio. h>
>> > int main(int argc, char *argv[])
>> > {
>> >   FILE *inFilePtr;   /*input file pointer*/
>> >   FILE *outFilePtr;   /*output fole pointer*/
>> >   int c,i;
>> >   /*check number of command-line arguments */
>> >   if(argc != 3){
>> >     printf("Usage: mycopy infile outfile\n"); } /*end if*/
>>
>> These messages are better off directed to stderr.
>>
>> >     else /*if input file can be opened*/
>> >       {
>> >         if((inFilePtr= fopen(argv[ 1],"r"))! =NULL)  /*if input
>> > file can be opened*/
>> >          { if((outFilePtr =fopen(argv[ 2], "w")) != NULL)
>> > /*if output file can be opened*/
>> >             {while((c = fgetc(inFilePtr) ) !=EOF) /*read and
>> > output characters*/
>>
>> That's your core loop. What you need is...
>>
>> while (...keep going condition... && (c = fgetc(inFilePtr) ) !=EOF)
>>
>> >               {
>> >             fputc(c,outFilePtr) ;}/*end while*/
>> >           }/*end if*/
>> >         else /*output file could not be opened*/
>> >           {printf("File\ "%s\" could not be opened\n", argv[2]);
>> >           } /*end else*/
>> >       }/*end if*/
>> >     else /*input file could not be opened*/
>> >     {  printf("File\ "%s\" coulk not be opened\n", argv[1]);}
>> >  /*end else*/
>>
>> ITYM could, not coulk.
>>
>> >               } /*end else*/
>> >      return 0; /*indicates successful termination* /
>>
>> Which would be an ironic thing to return if it couldn't open
>> either stream.
>>
>> >      }/*end main*/
>>
>> --
>> Peter
>>
>> New Email addresses available on Yahoo!
>> Get the Email name you&#39;ve always wanted on the new @ymail and
>> @rocketmail.
>> Hurry before someone else does!
>> http://mail. promotions. yahoo.com/ newdomains/ aa/
>>
>> [Non-text portions of this message have been removed]
>>
>> [Non-text portions of this message have been removed]
>>
>>  
>>
>
>
>
> --
> with Regards,
>
> Dhanaseelan Dhayalan,
> [There is a better way of Doing it !!! Find it !!!]
>



-- 
with Regards,

Dhanaseelan Dhayalan,
[There is a better way of Doing it !!! Find it !!!]


[Non-text portions of this message have been removed]

Reply via email to