How to writte something into an archive

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
WxNoob
Earned a small fee
Earned a small fee
Posts: 15
Joined: Mon Jan 28, 2008 7:03 pm

How to writte something into an archive

Post by WxNoob » Sat Mar 08, 2008 5:07 pm

Hello everybody, now i wonder how could I put text into a .bat file...

Why? Hum, i will explain then, i`m trying to do a software that have several CheckBoxes, and, when you push into the checkbutton, i would like to create a .bat file...

Erm...sorry if i dont have explained myself clear enogugh...

For example, i have one checkbox button called "Create archive" and when you mark the ckeckbutton, i would like to create in my Desktop a .bat file (i dont know if you know what is Batch) and, into that archive, writte for example

@echo off
echo hello
exit

That`s a simply batch programme structure, and i would like to create it throw a WxDevC++ programme...

Maybe this is a noob question, but i dont know how to do it...

I would be very grateful if someone of you could help me...

bojkar
Earned a small fee
Earned a small fee
Posts: 12
Joined: Mon Sep 24, 2007 10:39 am

Post by bojkar » Thu Apr 17, 2008 10:50 am

.bat file is simple text file. Create text file called file.bat and put into simple text. For example:

Code: Select all

FILE *f;
f = fopen("ex.bat", "wt");

fprintf(f, "@echo off \n") ;
fprintf(f, "echo hello \n");
fprintf(f, "exit \n");

fclose(f);
 


tbreina
Moderator
Moderator
Posts: 1289
Joined: Thu Nov 25, 2004 7:38 pm
Location: Coronado, CA

Post by tbreina » Thu Apr 17, 2008 1:23 pm

Or use wxTextFile:

http://docs.wxwidgets.org/stable/wx_wxt ... wxtextfile

It has useful functions built it. Plus, it'll automatically handle the line termination character for different platforms.

-Tony
Everybody's got something to hide except for me and my monkey.

Post Reply