Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OutputFileStream  (Read 4144 times)

0 Members and 1 Guest are viewing this topic.

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
OutputFileStream
« on: July 28, 2015, 06:08:13 pm »
Hey,

I think this wasn't a problem in the past because we could easily use std::fstream (or C API) to write to files, but with the mobile ports things have changed, at least on android you cannot use std::fstream and the C API only limited. So wouldn't it be nice to have a platform indipendent API to write files?


AlexAUT

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: OutputFileStream
« Reply #1 on: July 28, 2015, 06:24:52 pm »
You can't use fstreams on Android? Really?

Anyway, SFML uses the standard library for its file streams it wouldn't solve anything...
Laurent Gomila - SFML developer

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: OutputFileStream
« Reply #2 on: July 28, 2015, 06:44:59 pm »
On android there is a special ResourceStream for inputstreams implemented in SFML, the same could be done for Outputstreams. C File API for every platform except android where you have to use AAssetManager, which has basically the C File API with different names.



AlexAUT
« Last Edit: July 28, 2015, 11:04:51 pm by AlexAUT »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: OutputFileStream
« Reply #3 on: July 28, 2015, 08:38:01 pm »
Ah. I didn't know about it.
Laurent Gomila - SFML developer

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: OutputFileStream
« Reply #4 on: July 28, 2015, 11:04:29 pm »
I messed something up in my head. Writing files is actually possible with the C-API (idk if streams are implemented yet, during kroniax dev they weren't) but you need to get the path of the internal storage from your app, because the working dir is inside the apk and you cant obviously write into the apk. And to get the path you need the ANative_Activity -> Issue: https://github.com/SFML/SFML/issues/680
Mario is already working on it  ;)


AlexAUT

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: OutputFileStream
« Reply #5 on: July 29, 2015, 07:45:04 am »
Another possibility is to expose standard paths (app data, temp directory, ...) to the user. I think we already discussed this feature but I don't remember what was decided.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: OutputFileStream
« Reply #6 on: July 29, 2015, 09:01:10 am »
http://en.sfml-dev.org/forums/index.php?topic=17204.0

Nobody was really against it, but we didn't get to a concrete API yet. I suggest we continue the discussion about standard paths in the linked thread, as this one is about output streams.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: OutputFileStream
« Reply #7 on: August 06, 2015, 11:02:30 am »
"Standard paths" would be something for static members in a possible file-system implementation I guess. So no real extra work to be done, it's just a tiny feature to add to an even bigger feature that's planned. :)