Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,089 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
create empty .txt file #429751
09/17/13 22:20
09/17/13 22:20
Joined: Oct 2010
Posts: 73
0110111
C
CodeMaster Offline OP
Junior Member
CodeMaster  Offline OP
Junior Member
C

Joined: Oct 2010
Posts: 73
0110111
how create a empty .txt file in my working folder?
i can't find this function in the manual

Re: create empty .txt file [Re: CodeMaster] #429753
09/17/13 22:38
09/17/13 22:38
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Code:
// returns non-zero on success, zero on failure.
fixed create_empty_file(STRING* fname)
{
   if (fname == NULL)
      return 0;

   fixed handle = file_open_write(fname);

   if (handle)
      file_close(handle);

   return handle;
}



Always learn from history, to be sure you make the same mistakes again...
Re: create empty .txt file [Re: CodeMaster] #429754
09/17/13 22:48
09/17/13 22:48
Joined: Nov 2005
Posts: 204
Bavaria
HellThunder Offline
Member
HellThunder  Offline
Member

Joined: Nov 2005
Posts: 204
Bavaria
Hi!

Here is the link to the Manual. Yay it is a Little bit hidden.
http://www.conitec.net/beta/afile_open_read.htm

Code:
file_open_write (STRING* name);

or
Code:
file_open_append(STRING* name);


will do it.


But you can also use <stdio.h> for manipulate files.
Code:
FILE *document = fopen("FileName.txt", "w");


Here is a reference
http://www.cplusplus.com/reference/cstdio/


Create your own JRPG and join our community: https://www.yrpgtoolkit.com
Re: create empty .txt file [Re: Uhrwerk] #429755
09/17/13 22:54
09/17/13 22:54
Joined: Oct 2010
Posts: 73
0110111
C
CodeMaster Offline OP
Junior Member
CodeMaster  Offline OP
Junior Member
C

Joined: Oct 2010
Posts: 73
0110111
thanks to you i just noticed in manual if the file does not exist, it is created with file_open_write

thanks, problem is solved laugh


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1