Foros del Web » Programando para Internet » ASP Clásico »

URGENTE: Utilizar ficheros de texto SIN objetos

Estas en el tema de URGENTE: Utilizar ficheros de texto SIN objetos en el foro de ASP Clásico en Foros del Web. Hola a todos, lo que necesito es abrir y escribir en un fichero de texto sin crear ningun objeto con Filesystemobject ni nada por el ...
  #1 (permalink)  
Antiguo 31/07/2002, 10:12
 
Fecha de Ingreso: junio-2002
Mensajes: 58
Antigüedad: 22 años, 10 meses
Puntos: 0
URGENTE: Utilizar ficheros de texto SIN objetos

Hola a todos, lo que necesito es abrir y escribir en un fichero de texto sin crear ningun objeto con Filesystemobject ni nada por el estilo.
Me han dicho que utilizando algo asi:
Código:
  
open fichero   for append   AS #1
pero no lo entiendeo muy bien como ponerlo exactamente, y luego no se como escribir en ese fichero... ademas, si pongo lo de arriba el explorer me da un error "Se esperaba un final de instrucción".
Alguien sabe como hacer esto por favor???
Muchas gracias por la ayuda.
Un saludo.

<center><font face="verdana" color=#003366 size="1">One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.[/CODE]</center>
  #2 (permalink)  
Antiguo 01/08/2002, 01:22
 
Fecha de Ingreso: junio-2002
Mensajes: 58
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: URGENTE: Utilizar ficheros de texto SIN objetos

plis algun alma caritativa ke me eche una manita... se agradecerá eternamente... ;)
un saludo
  #3 (permalink)  
Antiguo 01/08/2002, 01:27
 
Fecha de Ingreso: enero-2002
Mensajes: 141
Antigüedad: 23 años, 4 meses
Puntos: 0
Re: URGENTE: Utilizar ficheros de texto SIN objetos

amigo, solo puede trabajarse con archivos de texto de 3 maneras

1.- con componentes (lo que tu no deseas)

2.- con filesystem objects (esta libreria esta instalada en todos los servidores y se hizo para personas que tiene tus necesidades)

3.- que lo manejes como una base de datos
de texto en formato delimited comma y lo edites con una conexion ADO

no existe otra
  #4 (permalink)  
Antiguo 01/08/2002, 02:06
 
Fecha de Ingreso: junio-2002
Mensajes: 58
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: URGENTE: Utilizar ficheros de texto SIN objetos

me gustaria que me dijeseis la forma de trabajar con ficheros con la cual tenga ke desproteger el servidor donde trabajo lo menos posible. Si me explicais la forma con algun ejemplillo lo agradeceré mucho.
Muchas gracias, un saludo.
  #5 (permalink)  
Antiguo 01/08/2002, 08:17
 
Fecha de Ingreso: enero-2002
Mensajes: 141
Antigüedad: 23 años, 4 meses
Puntos: 0
Re: URGENTE: Utilizar ficheros de texto SIN objetos

depende, si es una base de datos en texto,
debes usar ADO y una conexion OLEDB DNS LESS
que en criollo no significa mas que para conectarte y editar un archivo debes escribir un parametro de conexion,

Si solo son parrafos de texto
usa filesystem object

Si tienes acceso via ftp o vpn a una carpeta fuera del servidor web y los datos son confidenciales, pon alli tu archivo de texto,
tu aplicacion podra leerlo, pero nadie podra descargarlo o editarlo desde la web

Si es un hostin compartido, crea una carpeta especificamente para tu texto y via panel de control o webmaster del sitio cambiale los atributos a permiso de escritura y compartido
(Windows NT, W2K y XPServer piden la carpeta como compartida en la red)

Si usas filesystemobject, puedes llamar la pagina con extension asp, asi si alguien trata de descargarla recibira un error y no vera el contenido

Respecto a los ejemplos, busca en estos foros o en aspfacil,
si le das algo al ingles,
en http://www.iisworks.com/fileman/
tienes una aplicacion que edita los archivos y las bases de datos sin componentes solo tienes que instalarlo
aca te va un ejemplo de fso
  #6 (permalink)  
Antiguo 01/08/2002, 08:17
 
Fecha de Ingreso: enero-2002
Mensajes: 141
Antigüedad: 23 años, 4 meses
Puntos: 0
Re: URGENTE: Utilizar ficheros de texto SIN objetos

This can come in quite handy, as you can include text files on a web page, then have a web form that submits to the text file to update it. If you have a page that has information that changes frequently, and if you don't want to use a database to carry that information, using a text file is a viable alternative.

Here is the code that reads the text file:

&lt;%
Set fs = CreateObject(&quot;Scripting.FileSystemObject&quot ;)
filename=server.mappath(&quot;/kathi/test/writefile.txt&quot;)
Set readfile=fs.OpenTextFile(filename,1,False)
Do until readfile.AtEndOfStream
Text=readfile.readline
If Text=&quot;&quot; then
response.write &quot;&lt;p&gt;&quot;
Else
response.write Text
End If
Loop
readfile.close
set readfile=nothing
%&gt;

And here is the code that can write to the file:
&lt;%
Text = request(&quot;Text&quot;)
filename=server.mappath(&quot;/kathi/test/writefile.txt&quot;)
Set fs = CreateObject(&quot;Scripting.FileSystemObject&quot ;)
Set writefile = fs.OpenTextFile(filename, 2, True)
writefile.writeline(Text)
writefile.Close
set writefile=nothing
set fs=nothing
%&gt;

You'll notice that in the first example, there's the number 1, and in the second there's the number 2. You can also use the number 8. Here's what each does:
1: Opens file for reading. You can't write to this file.

2: Opens file for writing. You can't read this file. Anything written to this file will overwrite the previous contents.

8: Opens the file for appending; the previous contents is not overwritten.

You'll also notice that the first example has the word &quot;False&quot; in it while the second has &quot;True&quot; in it. True means that the file should be created if it doesn't already exist, while false means that a new file should not be created if it doesn't already exist.
  #7 (permalink)  
Antiguo 01/08/2002, 09:23
 
Fecha de Ingreso: junio-2002
Mensajes: 58
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: URGENTE: Utilizar ficheros de texto SIN objetos

muchas gracias tio, te lo agradezco mucho
un saludo ;)

<center><font face="verdana" color=#003366 size="1">One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.[/CODE]</center>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:41.