2 Replies - 1343 Views - Last Post: 20 April 2012 - 10:14 PM Rate Topic: -----

#1 xxr2hxx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 20-April 12

Reading text file with ASCII art to struct

Posted 20 April 2012 - 07:12 PM

Hi,
Need some help reading a text file to struct

.txt file attached.

so what i need to do is read the name, the ascii picture, and rating to a struct.

typedef struct {
    char name[50];
    char picture[100];
    int  rate;
}pic;

pic art[1000];



tried fgets with sscanf, but that reads each line of the file, which would be fine for the name but i would like to place the whole ascii picture to one array.

some guidance would be appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: Reading text file with ASCII art to struct

#2 simeesta  Icon User is offline

  • Deadly Ninja


Reputation: 215
  • View blog
  • Posts: 586
  • Joined: 04-August 09

Re: Reading text file with ASCII art to struct

Posted 20 April 2012 - 07:16 PM

Perhaps fread is what you're looking for.
Was This Post Helpful? 1
  • +
  • -

#3 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1573
  • View blog
  • Posts: 2,995
  • Joined: 30-May 10

Re: Reading text file with ASCII art to struct

Posted 20 April 2012 - 10:14 PM

Is this you? -> http://cboard.cprogr...ile-struct.html
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1