1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Reading Column in C

Discussion in 'C' started by johngrey, Mar 12, 2016.

  1. johngrey

    johngrey New Member

    Joined:
    Mar 12, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    #include<stdio.h>
    main()
    {
        FILE *pToFile;
        int input[512],i,j,k,l;
        pToFile=fopen("data.txt","r");
        if (pToFile !=NULL)
        {
            fscanf(pToFile,"%d%d %d %d %d",input,&i,&j,&k,&l);
            printf("%d\n%d\n%d\n %d\n %d\n %d\n", input,i,j,k,l);
            fclose(pToFile);
        }
        else
        {
            printf("could not open the file \n");
        }
       return(0);
    }
    
    I was wondering why this code doesn't want to work??
    and how to read a column in c programming
     
  2. senthil_a4nlabs

    senthil_a4nlabs New Member

    Joined:
    Aug 27, 2016
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    reading column is most coomon basics in c
     

Share This Page