Thread: hi all please help me

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    26

    hi all please help me

    i have a .txt file in that i want to take the date between 2008-12-16 to 2008-12-31 from snapshot_date column with this condition i want to pick the whole record.

    the below is code which it is reading .txt file, i want to know where i have to give the condition.please help me. I am new to c programing.
    Code:
    #include<stdio.h>
    #include "./fcf013h0.h"
    int main()
    {
    FILE *pfile;
    char my[200];
    pfile=fopen("my1.txt","r");
    if(pfile==NULL) perror("error in opening file");
    else {
    while(fgets(my, 200, pfile))
    {
    if (!strchr(my, '\n')) puts(my);
    else fputs(my, stdout);
    }
    puts(my);
    fclose(pfile);
    }
    return(0);
    }
    Thanks & Regards,
    Vijay

  2. #2
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    1) You should come up with a more descriptive summary for your thread - practically *every* thread on this forum is someone asking for help!
    2) Learn to indent your code, or no one is going to read it.

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by vijay85 View Post
    i have a .txt file in that i want to take the date between 2008-12-16 to 2008-12-31 from snapshot_date column with this condition i want to pick the whole record.
    That is literally incomprehensible.

    And this is some very crazy code:
    Code:
    if (!strchr(my, '\n')) puts(my);
    else fputs(my, stdout);
    }
    puts(my);
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    POeT GuY Matus's Avatar
    Join Date
    Feb 2008
    Location
    Bz
    Posts
    235
    Man, i sure do feel good getting back to the forums hopefully I'll start readimg em more once i got time. Cheers everyone
    PoEms R InsPiRatiOns of LIfE ExpErienCes!!


Popular pages Recent additions subscribe to a feed