Dev - C++ - IMPRESORAS EN VISUAL C++ 2010

 
Vista:

IMPRESORAS EN VISUAL C++ 2010

Publicado por LidayG (1 intervención) el 13/12/2013 17:10:24
Hola, estoy realizando un proyecto sobre un editor de texto en el cual por consola debe aparecer una ventana en la cual se puedan visualizar las impresoras ya predeterminadas para luego seleccionar una y se pueda enviar para que los archivos se puedan imprimir... he visto en posts anteriores mas o menos la forma en que se podria realizar este procedimiento pero simplemente no funciona...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* 
headers necesarios 
#include <iostream> 
#include <fstream> 
*/
 
int impresora()
{
char filename[15], ch[80];
int height = 0, page = 1;
printf("Ingresa el nombre del archivo: ");
cin.get( filename, 50 );
cout << endl;
//ifstream Source( filename );	 // abrimos el archivo 
ifstream Source("rep_imp.c");
ofstream Printer( "LPT1" ); // Open Printerstream 
if( (!Printer) || (!Source) ) // Checando streams 
{
if( !Printer )
{
printf("'\a' << Printer error!!!\n");
}
else
{
cout << '\a' << "Sourcefile error!!!" << endl;
}
cin.get();
}
else
{
cout << "Printing";
Printer <<"DAEN COPIADORAS\nhttp://www.fixedz.com"<<endl;
while(!Source.eof()) // deteniendo el ciclo de lectura 
{
Source.getline( ch, 80 ); // Copiando string 
/* 
if( height == 0 ) // Encabezado de Pagina 
{ 
Printer << filename << " Page " << page << endl<< endl; 
page++; 
} 
if( height == 57 ) 
{ 
Printer << '\f'; // Expulsando Hoja 
height = 0; 
} 
*/
Printer << ch << endl; // Print stream 
cout << ".";
//height++; 
} // Expulsando ultima hoja 
Printer << '\n';
Printer << '\n';
Printer << '\n';
Printer << '\n';
 
Printer.close(); // Cerrando streams 
Source.close();
 
cout << endl << "Printing done" << endl;
cin.get();
}
}


Y este es otro codigo::::::
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <fstream.h>
#include <stdlib.h>
# include<stdio.h>
 
FILE *fpr;
char palabra[85];
char *c;
 
void main() {
ofstream impresora;
impresora.open("LPT1");
 
fpr = fopen("Original.txt", "r"); /*Abrir archivo para lectura*/
 
if (fpr == NULL)
{ printf("Error al abrir el archivo \n"); exit (EXIT_FAILURE); }
 
do
{
c = fgets(palabra,85 , fpr); /* Obtiene una linea del archivo */
impresora << c ;
 
}
while (c != NULL); /* Se repite hasta encontrar NULL */
 
impresora.close();
fclose(fpr);
}

... En realidad no se que podria star mal, y en si como podria realizarle... alguna idea?
Ojala alguien pueda ayudarme... de antemano muchas gracias ^^
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder