Read different datatypes from file.

Discussion in 'C' started by tapender_iitp, Jan 6, 2013.

  1. tapender_iitp

    tapender_iitp New Member

    Joined:
    Jan 6, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I want to read a data of type int, character string and float from a file and store it in an array of structure.I read the data from the file and stored it in an character array. now i m using sscanf to store extract the different datatypes from this character array to store in the array of structure with three different elements and datatypes. but it is showing me a segmentation fault. kindly suggest me some remedy or else suggest a better method.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    A segfault means your program is writing to some memory it shouldn't be writing to (typically a NULL pointer).
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice