reading data from file

You must understand the Game Editor concepts, before post here.

reading data from file

Postby mt » Sun Jan 14, 2007 4:37 pm

i have created a text file, which is my sort of like my database of player names. it has 2 columns.first for the name and second for what type of player he is.
now i want to read the data from that file and display the name using text actor.plz if any one knows how to do it, help us?
User avatar
mt
 
Posts: 34
Joined: Wed Dec 06, 2006 1:52 pm
Score: 2 Give a positive score

Postby Game A Gogo » Sun Jan 14, 2007 6:22 pm

i think it tells you how to read from *.txt files in the documentation http://game-editor.com/docs
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby makslane » Mon Jan 15, 2007 12:30 am

makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby mt » Mon Jan 15, 2007 2:57 pm

thankz i figured it out. :)
User avatar
mt
 
Posts: 34
Joined: Wed Dec 06, 2006 1:52 pm
Score: 2 Give a positive score

help needed again

Postby mt » Wed Jan 17, 2007 8:56 am

ok i did it like this.
FILE *fptr;
fptr=fopen("myfile.txt","r");
fscanf(fptr,"%s",&mystringvariable);
strcpy(mytextactor.text,mystringvariable);

it works and it displays the text from the file but now i want to increment the pointer(fptr) to the next line when the player is out. but i don't want to display the name of the player that has already been out. should i save the out player inanother file and compare them or something? need help plz... :?
User avatar
mt
 
Posts: 34
Joined: Wed Dec 06, 2006 1:52 pm
Score: 2 Give a positive score

Postby makslane » Wed Jan 17, 2007 1:05 pm

The file pointer already incremented after the read.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby mt » Thu Jan 18, 2007 3:18 pm

but i want to increment after the player is out. :( i guess im not explaining it right. oh well i'll try to figure this out somehow.
User avatar
mt
 
Posts: 34
Joined: Wed Dec 06, 2006 1:52 pm
Score: 2 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron