Problem: my code FILE<--RESOLVED->Tnk MAk

Non-platform specific questions.

Problem: my code FILE<--RESOLVED->Tnk MAk

Postby equinox » Thu Apr 09, 2009 10:56 pm

IN this code there is a error,,, but i dont found it.

FILE*file;//*** LOAD CHAR E PRINT

file = fopen("TextNote.txt", "r");
fread(&N, sizeof(N), 2, file);
fclose(file);

strcpy(A1.text, N[0][0]);// funzia
//sprintf(getclone2(A1.name, 0)->text ,"NAME: %s", N[0]);

some ideas on how to solve it,please?
Tnk1000.
Attachments
FILE.rar
(126.16 KiB) Downloaded 93 times
Last edited by equinox on Sun Apr 12, 2009 8:10 am, edited 3 times in total.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: Problem: my code FILE write string array

Postby makslane » Fri Apr 10, 2009 3:19 pm

Can you explaint what you want and the format of the TextNote.txt file?
The TextNote.txt isn't a text file!
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Problem: my code FILE

Postby equinox » Sat Apr 11, 2009 12:05 pm

FILE *f;
int PX = 10;
int F[3] = {1,2,3}
memset(PX,0,sizeof(PX));
memset(F,0,sizeof(F));
if((f = fopen("save.txt", "wb"))){
fwrite(PX, 1, sizeof(PX),f);
fwrite(F, 1, sizeof(F),f);
fclose(f);
-----------------------------
if((f = fopen("save.txt", "rb"))){
fread(PX, 1, sizeof(PX),f);
read(F, 1, sizeof(F),f);
fclose(f);
-------------------
sprintf("PX %d", PX);
sprintf("F[0] %d", F[0]);
but not print .
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: Problem: my code FILE

Postby makslane » Sat Apr 11, 2009 12:23 pm

Try reproduce this code on your ged file.
There are some things wrong in your code, like useing "w" intead "wb" or "r" instead "rb".
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Problem: my code FILE

Postby equinox » Sun Apr 12, 2009 8:10 am

Yes !!!
There are some things wrong in your code, like useing "w" intead "wb" or "r" instead "rb".
Tnk1000 Mak, the solution was "r" and "w" != "wb" "rb"
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron