Raised This Month: $51 Target: $400
 12% 

Get all nVault entries?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-13-2006 , 22:11   Get all nVault entries?
Reply With Quote #1

Is there a way to collect or read through all of the entries in an nVault without knowing the names of all the keys? I thought about using the regular file functions to read through the nVault itself, but it uses zero characters so it can't all be read by AMXx.

Thanks.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
raa
Senior Member
Join Date: Oct 2005
Old 02-12-2007 , 22:52   Re: Get all nVault entries?
Reply With Quote #2

has a way to do this been figured out ?
__________________
raa is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-12-2007 , 23:13   Re: Get all nVault entries?
Reply With Quote #3

Not by me at least. I decided to use my own flat file format (this was for GunGame).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-13-2007 , 08:40   Re: Get all nVault entries?
Reply With Quote #4

the sourcecode from nvault is available. try to port it to amxx
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-13-2007 , 17:36   Re: Get all nVault entries?
Reply With Quote #5

Like I said, it wouldn't work. Null characters are written to the vault (not just at the end of a line or at the end of the file), and since Pawn uses null-terminated strings, it can't be properly read by Pawn.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-18-2007 , 16:23   Re: Get all nVault entries?
Reply With Quote #6

dont use read_file...
use the "new file natives".
fopen, fread, fgetc, ect.
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-18-2007 , 17:20   Re: Get all nVault entries?
Reply With Quote #7

read_file calls fopen. The result is slower, but the same. It doesn't change how Pawn works in regards to null-characters.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-19-2007 , 02:17   Re: Get all nVault entries?
Reply With Quote #8

read_file, reads the file per line.
with the other file natives you are not forced to do this, since they are a direct wrapper to the standard c functions. btw. in C each string has the null character as the last char also.

if you dont get it, read the file with fgetc...
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-19-2007 , 19:06   Re: Get all nVault entries?
Reply With Quote #9

If I use fgets, it will stop at the null character, or it will in essence because it records a null character and Pawn marks that as the end of the string. If I use some other function to read the entire file at once, I have to create a buffer massive enough to hold all of the data. Even if I do that, none of the Pawn string functions will work correctly on the data, since it has null characters.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-20-2007 , 02:42   Re: Get all nVault entries?
Reply With Quote #10

man, C and PAWN are using the same format for strings ( null terminated )
use fread and you will be fine...
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Reply



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 07:52.


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