AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get all nVault entries? (https://forums.alliedmods.net/showthread.php?t=47278)

XxAvalanchexX 11-13-2006 22:11

Get all nVault entries?
 
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.

raa 02-12-2007 22:52

Re: Get all nVault entries?
 
has a way to do this been figured out ?

XxAvalanchexX 02-12-2007 23:13

Re: Get all nVault entries?
 
Not by me at least. I decided to use my own flat file format (this was for GunGame).

Greenberet 02-13-2007 08:40

Re: Get all nVault entries?
 
the sourcecode from nvault is available. try to port it to amxx

XxAvalanchexX 02-13-2007 17:36

Re: Get all nVault entries?
 
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.

Greenberet 02-18-2007 16:23

Re: Get all nVault entries?
 
dont use read_file...
use the "new file natives".
fopen, fread, fgetc, ect.

XxAvalanchexX 02-18-2007 17:20

Re: Get all nVault entries?
 
read_file calls fopen. The result is slower, but the same. It doesn't change how Pawn works in regards to null-characters.

Greenberet 02-19-2007 02:17

Re: Get all nVault entries?
 
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...

XxAvalanchexX 02-19-2007 19:06

Re: Get all nVault entries?
 
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.

Greenberet 02-20-2007 02:42

Re: Get all nVault entries?
 
man, C and PAWN are using the same format for strings ( null terminated )
use fread and you will be fine...


All times are GMT -4. The time now is 06:48.

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