Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (blaurock), 750 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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