PillalamarriVenkateswaraRao
asked on
Open the file which is not having any file extension
Hello All,
We are having lots of files which are generating from ERP. Those files are not having any extenstion type. So how can open those files from our delphi application.
Thanks
We are having lots of files which are generating from ERP. Those files are not having any extenstion type. So how can open those files from our delphi application.
Thanks
..assuming the files aren't encrypted and are in ascii format, right?
A big assumption =P Basically an example of a text file without an extension..
ASKER
Thanks for the information.
Here I'm using ShellExecute Function to access the file (In our example c:\test)
Here test is not having any file extension. So how can open that file.
Thanks.
Here I'm using ShellExecute Function to access the file (In our example c:\test)
Here test is not having any file extension. So how can open that file.
Thanks.
Ah you mean execute it not open it for read/write.
Is the file you want to execute a text file or a file with readable text? Or is it an executable file you wish to run?
Is the file you want to execute a text file or a file with readable text? Or is it an executable file you wish to run?
You can go into File Associations in windows where you set which programs are associated with which file extensions. For example html files are launched by your default web browser. If you install a new web-browser, it will usually change this. Same with mp3s. But here comes the problem - the file is extension-less, and I don' t think you can set a file association for an extensionless file.
Meaning, quite simply, that I don't think you can 'execute' an extensionless file.
I could be wrong.
Meaning, quite simply, that I don't think you can 'execute' an extensionless file.
I could be wrong.
Do you want to be able to edit it as a text file?
Have you just tried loading it directly into a TMemo?
memo1.lines.loadfromfile(' c:\myfile' )
Never tried it myself but I don't see why you can't.
Have you just tried loading it directly into a TMemo?
memo1.lines.loadfromfile('
Never tried it myself but I don't see why you can't.
why don't you just rename the file before opening it ?
normally when you process a erp file, you start with giving it a different extension like '.prc' (processing)
when finished you give it '.ok' or '.err'
normally when you process a erp file, you start with giving it a different extension like '.prc' (processing)
when finished you give it '.ok' or '.err'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use the code below like this(Just a rough example):
procedure TForm1.Button1Click(Sender
var
MyFile : DWORD;
begin
MyFile := OpenFile('C:\test');
If MyFile <> INVALID_HANDLE_VALUE Then
begin
WriteLineToFile(MyFile,'He
CloseHandle(MyFile);
end;
end;
Open in new window