About Store Forum Documentation Contact
Donations:
364$/mo



Post Reply 
File.put
Author Message
Houge Offline
Silver Supporter

Post: #1
File.put
Hi!

Please can you add to File.put... the following types (currently there are only File.putInt and File.putUInt):

I16, U16,
I64, U64

Currently i'm using my own functions.
I don't think it will take very long time to add it smile
(This post was last modified: 09-14-2014 05:16 PM by Houge.)
09-14-2014 05:16 PM
Visit this user's website Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #2
RE: File.put
Hi Houge, just use operator<< and operator>> for those. If you look at what putInt() and others do, it's basically just a wrapper for the operator functions essentially calling put(CPtr data, Int size).
(This post was last modified: 09-14-2014 05:50 PM by aceio76.)
09-14-2014 05:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Houge Offline
Silver Supporter

Post: #3
RE: File.put
Thanks for suggestion, i wrote that use such things. Just when i need to do something like:

Code:
File f; f.writeMem()
      .putStr("...")
      .putU64(nnn)
      .putBool(false)
      .putStr("...");
It's more easy to use File function instead of "<<" wink
(This post was last modified: 09-14-2014 06:44 PM by Houge.)
09-14-2014 06:43 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: File.put
Hi,

This will be available in next release:
Code:
File& putBool  (  Bool  b) {T<<b; return T;}   Bool  getBool  () {Bool   b; T>>b; return b;} // write/read  Bool
   File& putByte  (  Byte  b) {T<<b; return T;}   Byte  getByte  () {Byte   b; T>>b; return b;} // write/read  Byte
   File& putShort (  Short i) {T<<i; return T;}   Short getShort () {Short  i; T>>i; return i;} // write/read  Short
   File& putUShort( UShort u) {T<<u; return T;}  UShort getUShort() {UShort u; T>>u; return u;} // write/read UShort
   File& putInt   (  Int   i) {T<<i; return T;}   Int   getInt   () {Int    i; T>>i; return i;} // write/read  Int
   File& putUInt  ( UInt   u) {T<<u; return T;}  UInt   getUInt  () {UInt   u; T>>u; return u;} // write/read UInt
   File& putLong  (  Long  i) {T<<i; return T;}   Long  getLong  () {Long   i; T>>i; return i;} // write/read  Long
   File& putULong ( ULong  u) {T<<u; return T;}  ULong  getULong () {ULong  u; T>>u; return u;} // write/read ULong
   File& putFlt   (  Flt   f) {T<<f; return T;}   Flt   getFlt   () {Flt    f; T>>f; return f;} // write/read  Float
   File& putDbl   (  Dbl   d) {T<<d; return T;}   Dbl   getDbl   () {Dbl    d; T>>d; return d;} // write/read  Double
   File& putUID   (C UID  &i) {T<<i; return T;}   UID   getUID   () {UID    i; T>>i; return i;} // write/read  UID
You can put that in your header file
09-14-2014 11:48 PM
Find all posts by this user Quote this message in a reply
Houge Offline
Silver Supporter

Post: #5
RE: File.put
Thank you very much!

Just a quick question (for clarification):
Is your "Long" equivalent to I64?

If not, can you please add I64 and U64 also?
If yes - i always thought that "long" equals "int" 4 bytes, and "long long" equals "__int64". MSDN agrees with it, here is the link http://msdn.microsoft.com/en-us/library/s3f49ktz.aspx
09-15-2014 05:15 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #6
RE: File.put
typedef PLATFORM( signed __int64, int64_t) I64, Long; // Signed Int (64-bit) -9 223 372 036 854 775 808 .. 9 223 372 036 854 775 807


Ctrl+Leftclick in EE code editor shows the data range.

by the way you've got source access, this is easy for you to check out in visual studio.
(This post was last modified: 09-15-2014 05:25 AM by Zervox.)
09-15-2014 05:23 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Silver Supporter

Post: #7
RE: File.put
Thanks Zervox, my fault i didn't check it smile
Ok no questions, all clear!
09-15-2014 05:26 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply