All pastes #2049428 Raw Edit

Untitled

public text v1 · immutable
#2049428 ·published 2011-04-22 18:31 UTC
rendered paste body
   #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
     
    int main(int argc, char* argv[])
    {
            FILE *fp;
            int x=0;
            char* str=malloc(sizeof(char)*512);
            char* file=malloc(sizeof(char)*100);
            char* junk=malloc(sizeof(char)*10000);
            char* select_ats=malloc(sizeof(char)*10000);
            char* num_group_var=malloc(sizeof(char)*10);
            char* group_ats=malloc(sizeof(char)*10000);
            char* f_vect=malloc(sizeof(char)*10000);
            char** select_cond=(char**)malloc(sizeof(char*)*100);
            int q=0;
            for(q=0;q<100;q++)
            {
                    select_cond[q]=malloc(sizeof(char)*10000);
            }
            printf("Please enter input:\n");
            scanf("%s",str);
     
            strcpy(select_ats,str); //Insert value into array
     
            //Paste to file
            fp=fopen("mf_structure.h","w");
            fputs(select_ats,fp);         
            fclose(fp);

            fp=fopen(str, "r");
            fgets(junk,10000,fp);
            fgets(select_ats,10000,fp);
            fgets(junk,10000,fp);
            fgets(num_group_var,10,fp);
            fgets(junk,10000,fp);
            fgets(group_ats,10000,fp);
            fgets(junk,10000,fp);
            fgets(f_vect,10000,fp);
            fgets(junk,10000,fp);
            fclose(fp);
            while((fgets(select_cond[x],10000,fp))!=NULL)
            {
                    x++;
            }
            printf("Here's what you input: %s\n%s\n%s\n%s\n%s\n",file,select_ats,num_group_var,group_ats,f_vect);

            fputs("//---------------------------------------------------------------------\n",fp);
            fputs("//This file contains the mf structure used to hold the data needed for\n",fp);
            fputs("//the mf query\n",fp);
            fputs("//---------------------------------------------------------------------\n",fp);
            fputs("struct MF_STRUCTURE\n",fp);
            fputs("{\n",fp);
            fputs("}\n",fp);
            fclose(fp);
            printf("\n");
            return 0;
    }