i am suppose to retrive data from an ini file... I am able to retrive the entire file but not able to read and store specific contents from a file for further manipulation.....
Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


char function1(FILE *fp,char *str);
char function2(char ,char *);

int main(int argc, char *argv[])
{
FILE *fp;
char *str,*str1;
char ch;
if(argc<4)
{
 printf("Inadequate number of inputs");
}
else
{
        while(((ch=fgetc(fp))!=EOF))
        {
                if(ch=='[')
                function1(fp,str);
                printf("hhhh");
                break;
        }
}

}

char function1(FILE *fp,char *str)
{
        int a,i;
        char ch;
        char arr[20];
        while(((ch=fgetc(fp))!=EOF))
        {
          // if(ch!=']'||ch!='[')
        if( strcmp(fp,str ) == 0 )
        {
        for(i=0;i<20;i++)
        {
        arr[i]=ch;
 printf("%c",arr[i]);
        }
        function2(arr,*str2);
        }
        else
        return;
        }
}

char functon2(char arr,char *str1)
{
        int b;
        if(arr!=']'||arr!='[')
        b=strcmp(arr,str1);
        if(b!=1)
        printf("%s",str1);

}


i ve prob in function1 and function2..
help me out...

Last edited by shabbir; 24Jan2008 at 21:25.. Reason: Code block