Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

2 total

Lectura de archivo secuencial en C

// Ejemplo de lectura de archivo secuencial

#include <stdio.h>

void main()
{
    FILE *ptr;
    char nombre[15],c;
    int ok, edad;

    ptr = fopen("datos.txt", "r");

    do
    {
						/* Obtiene datos del archivo*/
        ok = fscanf(ptr, "%d %s", &edad, nombre);
	   if (ok)
           printf("Edad: %d\n Nombre:%s\n", edad, nombre); /* despliega en pantalla */
	   else
	   printf("*****Error en la lecura");
    }
    while (!feof(ptr));            /* Se repite hasta encontrar EOF (ctrl + z) */

    fclose(ptr);
    printf("pulse una tecla para continuar");
    scanf("%c", &c);
}

mimimee 123

// description of your code here

index.php
<html>
	<head>
		<script type="text/javascript" src="modul - clock.php"></script>
		<script type="text/javascript">
			window.onload=function(){		//functia asta porneste script-ul la incarcarea paginii.
			setInterval("displaytime()", 1000)
		}
	</script>
</head>

<body>
<?php $time = "".date("d-m-Y")."<br>".date("H:i:s").""; /*NECESAR pentru a inlocui delay-ul pana ce se incarca script-ul*/?>
<span id="clock" style="position:relative;"><?=$time;?></span>
</body>
</html>

2 total