WriteString - Save a string at runtime

  • Let's assume I want to store the actual date and time when the game is over in a logfile that I can later access manually. I'm doing the following, but it seems to not update the file at all:

    (gamedata2 is defined as int-array, gamedata is defined as string)

    'write game status to file
    gamedata2=GetDate()
    gamedata=" GameOver:"+gamedata2[2]+"/"+gamedata2[1]+"-"+gamedata2[3]+":"+gamedata2[4]
    Local file:=FileStream.Open("cerberus://internal/usage.txt","a")
    file.WriteString(gamedata,"utf8")
    file.Close

  • I will try tonight or tommorow. Some questions:

    Which target platform and OS?
    Was the file initially created and is already there, so you just want to update it?

  • Are you sure it doesn't update? Your code adds the same value in a row. Is that location of your code even called?
    Where on your mac is the app stored?

    There is a file example in the examples/mojo/mak folder, you can modify it and will see that it works.

  • - Yes, I'm sure it is called, since it's at the start of the game AND at the end of the game.

    - The file usage.txt is still the same at the end, modification date didn't change and the content is only what has been there before, which is just "Usage "

    - Maybe I should upload to dropbox and let you take a look. I'm really clueless here.

  • Ok, I have seen your screenshot and you are looking into the initial folder of your project. You need to look into the internal folder inside your app resources.

  • @yodasvideoarcade Seriously, dawlane has showed you where to look for regarding Apple app bundles. OSX is not Windows nor Linux.
    Windows 10 handles files and folders where you can store stuff differently than XP.
    If you are not willing to familiarize yourself with the development platform you want to release your apps on, you won't get very far.
    CX is definitely not a tool for someone who wants just to press a button and voila, the app gets uploaded into the appstore.

    Do you find at least the .app file that was created from Xcode? Or are you unable to locate that too?
    If you found it, this is the app bundle. Right click on that file and select Show content.
    There inside the resources folder and its children, you find what you are looking for.

  • I don't use Windows or Linux, no idea about how it works there. I just used Blitzmax, Monkey, and now Cerberus, all on Mac. I don't need to release the apps, nor upload to the app store. They just need to run on HTML5 and on my computer (or the one I copy it to). Please try some of my games at yodasvideoarcade.com and tell me they're not fun to play. ;)

    Yes, now I found it. In appname.buildv2018-04-22/glfw3/xcode/build/release/

    How could I have known that the actual app I click on to run it is called an app-bundle? And also, how could I know that right-clicking on it shows a folder with contents?

    But anyway, now I know. I appreciate the explaination. That's exactly what I needed. If you ever come to Frankfurt, let me know so you can be my guest to play one of my Escape Rooms.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!