Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Create a File Exact Syntax

Posted on 2001-08-22
6
Medium Priority
?
178 Views
Last Modified: 2010-04-06
Hello i want the Exact Syntax as if you were doing this yourself

Create a File called   abc.dat in C:\
so the path is  C:\abc.dat

ok i want to push a button and the file has been created
the file is empty no data just a blank file...

thanks in advance neopolis
i am new at delphi so i need exact code...
0
Comment
Question by:neopolis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 10

Expert Comment

by:Jacco
ID: 6414579
Hi there,

procedure CreateFile(const aFileName: string);
var
  F: TextFile;
begin
  AssignFile(F, aFileName);
  Rewrite(F);
  CloseFile(F);
end;

Regards Jacco
0
 

Author Comment

by:neopolis
ID: 6414697
i cant get it to write the abc.dat file can you create it in Delphi the copy the source code and paste it here
so i can see where the File name and Path go thanks
0
 
LVL 6

Expert Comment

by:edey
ID: 6414873
Ummmmm, take the above procedure & call it like so:

createFile('C:\abc.dat');

simple enough, no? Parameter passing is a _very_ basic element of any language, I would think that you'd be well served by a couple of hours reading your manual.

GL
Mike
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Accepted Solution

by:
VSF earned 40 total points
ID: 6414899
Here is the complete usage of the code!
Hope it helps!
VSF
www.victory.hpg.com.br

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure CreateFile(const aFileName: string);
var
 F: TextFile;
begin
 AssignFile(F, aFileName);
 Rewrite(F);
 CloseFile(F);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 CreateFile('c:\abc.dat');
end;

end.
0
 

Author Comment

by:neopolis
ID: 6415092
thanks this works for me
0
 
LVL 3

Expert Comment

by:VSF
ID: 6418504
I'm glad I could help!

VSF
UIN: 14016999

Please show your support by visiting my homepage:
www.victory.hpg.com.br
www.enge.cjb.net
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question