Ver Mensaje Individual
  #3 (permalink)  
Antiguo 20/07/2010, 16:49
lynead
 
Fecha de Ingreso: julio-2010
Mensajes: 2
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: CMD - Comando msg - ayuda

Buenas, acabo de leer tu mensaje, y solo se me ocurre lo que dices con C, acabo de escribir el código y funciona, queda una cosa así:

Código c:
Ver original
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int cuenta(FILE *);
  6.  
  7. int main()
  8. {
  9.    FILE *fichero=NULL;
  10.    char buffer[250];
  11.    char *p;
  12.    char c;
  13.    int posicion=0;
  14.    int caracteres;
  15.  
  16.    if(!(fichero=fopen("text.txt","rt")))
  17.    {
  18.        perror("error");
  19.       return 0;
  20.    }
  21.  
  22.    caracteres = cuenta(fichero);
  23.    p=(char *) malloc(caracteres*sizeof(char));
  24.  
  25.    fseek(fichero,0,SEEK_SET);
  26.    while((c=fgetc(fichero))!=EOF)
  27.    {
  28.     *(p + posicion) = c;
  29.       posicion++;
  30.    }
  31.  
  32.    printf("%s",p);
  33.    getchar();
  34.    fflush(stdin);
  35.   sprintf(buffer,"msg * %s",p);
  36.   system(buffer);
  37.  
  38.   fclose(fichero);
  39.   return 1;
  40. }
  41.  
  42. int cuenta(FILE *fichero)
  43. {
  44.    char c;
  45.    int caracteres=0;
  46.  
  47.    fseek(fichero,0,SEEK_SET);
  48.    while((c=fgetc(fichero))!=EOF)
  49.       caracteres++;
  50.    return caracteres;
  51. }


En el primer getchar se puede ver que en el verctor p se guarda toda la información bien, pero con el comando msg solo imprime una linea del fichero.
Alomejor con el comando type se pueda hacer algo también, de todas formas este comando (msg) a partir de windows vista ya no esta.