C/Visual C - como recorrer fichero desde hasta donde kiero

 
Vista:

como recorrer fichero desde hasta donde kiero

Publicado por Cris (9 intervenciones) el 14/05/2006 11:21:09
tengo dos html uno para ver y otro para modificar, lo uqe kiero es modificar de PAginaPRincipal3 el titulo, resumen y foto. PAra ello recorro el fichero hasta q llega a la linea anterior a el texo, es decir "<FONT FACE.................>", escribo todo por ser constante tal y como esta, pido al usuario q me introduzca el neuvo titulo y lo escribo en el fichero, hasta ahroa tdo bien, el fichero esta cambiando. A continuacion kiero qeu me escriba desde la linea siguiente hasta justo "<div id=\"resumen_cronica\">" para poder poner la nueva foto al pedirle al usuario.
El problema es que con while (in.getline(line, SIZE)) con el titulo, me escribe el texto hasta el final, y al poner de nuevo para la foto me inicia.

Alguna [email protected] [email protected]

void part::menu_part()
{
const int SIZE =2000;
char *line =new char [SIZE];
string tit; string res; string fot; string b;
ifstream in ("PaginaPrincipal3.html");
ofstream out("PaginaPartido.html");
while(in.getline(line,SIZE)) ************AQUI ME EMPIEZA DESDE INICIO HASTA LA LINEA
{
out << line << endl;
parte="<FONT FACE=\"Times New Roman\" COLOR=\"Navy\" Size=\"3\"><B>";
int a=strcmp(line,parte);
if(a==0)
{
break;
}
}
cout <<"introduce el titulo"<<endl;
fflush(stdin);
getline(cin,tit);
out << tit << endl;**************************AQUI ME ESCRIBE PERO LUEGO TODO ENTERO

while (in.getline(line, SIZE)) ************ME EMPIEZA DESDE INICIO DE NUEVO
{ out << line<< endl;
int a=strcmp(line,"<div id=\"resumen_cronica\">");
if(a==0)
{
break;
}
}

cout <<"introduce la foto"<<endl;
fflush(stdin);
getline(cin,fot);
b.append("<IMG SRC=\"");
cout<<b<<endl;
b.append(fot);
cout<<b<<endl;
b.append("\" HEIGTH=\"250\" Width=\"250\" ALIGN=\"LEFT\">");
cout <<b<<endl;
out<<b<<endl;
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