Raised This Month: $ Target: $400
 0% 

read_file help me


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JonathanRF
New Member
Join Date: Jan 2011
Old 01-13-2011 , 20:20   read_file help me
Reply With Quote #1

hi every1, i'm from brazil, so sry for my bad english,
PHP Code:
[...]
    new 
arquivo[62]; // arquivo = file (portuguese...)
    
new usrname[32];
    
    
get_user_name(id,usrname,31)
    
    
replace_all(usrname,31,":","_00");
    
replace_all(usrname,31,">","_01");
    
replace_all(usrname,31,"<","_02");
    
replace_all(usrname,31,"/","_03");
    
replace_all(usrname,31,"?","_04");
    
    
format(arquivo,sizeof(arquivo),"addons/amxmodx/data/users/%s.txt",usrname)
    
    
/*and here i wanna read the file, are 4 lines, i tried to do it:
    new data[4][31];
    new ln;

    read_file(arquivo,0,data[0],30,ln);
    read_file(arquivo,1,data[1],30,ln);
    etc...
    but "data[x]" hasn't the content of the line
    */
[...] 
help me please
thx

Last edited by JonathanRF; 01-13-2011 at 20:31.
JonathanRF is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-13-2011 , 20:25   Re: read_file help me
Reply With Quote #2

Looks fine.
Make sure that the directory exists as well as the file.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
JonathanRF
New Member
Join Date: Jan 2011
Old 01-13-2011 , 20:28   Re: read_file help me
Reply With Quote #3

file and directory exists...
JonathanRF is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-13-2011 , 20:35   Re: read_file help me
Reply With Quote #4

Show your code that writes to the file.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
JonathanRF
New Member
Join Date: Jan 2011
Old 01-13-2011 , 20:37   Re: read_file help me
Reply With Quote #5

PHP Code:
    new arquivo[62];
    new 
usrname[32];
    
    
get_user_name(id,usrname,31)
    
    
replace_all(usrname,31,":","_00");
    
replace_all(usrname,31,">","_01");
    
replace_all(usrname,31,"<","_02");
    
replace_all(usrname,31,"/","_03");
    
replace_all(usrname,31,"?","_04");
    
    
format(arquivo,sizeof(arquivo),"addons/amxmodx/data/users/%s.txt",usrname)
    
    
//Escreve no Arquivo (write to file)
    
write_file(arquivo,"1",0);
    
write_file(arquivo,"0",1);
    
write_file(arquivo,"0",2);
    
write_file(arquivo,"1000",3); 
JonathanRF is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-13-2011 , 20:45   Re: read_file help me
Reply With Quote #6

Show the contents of the file when it is written to (the actual file contents, don't just type it out).
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
JonathanRF
New Member
Join Date: Jan 2011
Old 01-13-2011 , 20:50   Re: read_file help me
Reply With Quote #7

content of file:
Code:
1
0
0
1000
Filename:
EU_01SOU_02EU_00SENDO_03EU.txt (my nickname: EU>SOU<EU:SENDO/EU)
JonathanRF is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-13-2011 , 20:59   Re: read_file help me
Reply With Quote #8

Everything seems fine. I don't see where the problem would be.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode