Click here to Skip to main content
15,894,540 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Regarding Record to MoveFirst,MoveLast and Move Previous. Pin
CPallini15-Oct-09 8:55
mveCPallini15-Oct-09 8:55 
QuestionSpinButtonCtrl not working Pin
A&Ms15-Oct-09 4:12
A&Ms15-Oct-09 4:12 
AnswerRe: SpinButtonCtrl not working Pin
Rajesh R Subramanian15-Oct-09 5:24
professionalRajesh R Subramanian15-Oct-09 5:24 
Questionhow to write a display program or a reader program?? Pin
mr bard215-Oct-09 1:50
mr bard215-Oct-09 1:50 
AnswerRe: how to write a display program or a reader program?? Pin
Cedric Moonen15-Oct-09 1:54
Cedric Moonen15-Oct-09 1:54 
GeneralRe: how to write a display program or a reader program?? Pin
mr bard215-Oct-09 2:36
mr bard215-Oct-09 2:36 
GeneralRe: how to write a display program or a reader program?? Pin
Cedric Moonen15-Oct-09 2:45
Cedric Moonen15-Oct-09 2:45 
AnswerRe: how to write a display program or a reader program?? Pin
Richard MacCutchan15-Oct-09 2:09
mveRichard MacCutchan15-Oct-09 2:09 
QuestionRe: how to write a display program or a reader program?? Pin
David Crow15-Oct-09 3:17
David Crow15-Oct-09 3:17 
AnswerRe: how to write a display program or a reader program?? Pin
Rajesh R Subramanian15-Oct-09 3:43
professionalRajesh R Subramanian15-Oct-09 3:43 
QuestionIHTMLDocument2 for Table Par [modified] Pin
NaveenHS15-Oct-09 1:19
NaveenHS15-Oct-09 1:19 
AnswerRe: IHTMLDocument2 for Table Par Pin
«_Superman_»15-Oct-09 6:40
professional«_Superman_»15-Oct-09 6:40 
GeneralRe: IHTMLDocument2 for Table Par Pin
NaveenHS16-Oct-09 1:06
NaveenHS16-Oct-09 1:06 
GeneralRe: IHTMLDocument2 for Table Par Pin
«_Superman_»16-Oct-09 5:01
professional«_Superman_»16-Oct-09 5:01 
GeneralRe: IHTMLDocument2 for Table Par Pin
NaveenHS19-Oct-09 1:02
NaveenHS19-Oct-09 1:02 
GeneralRe: IHTMLDocument2 for Table Par Pin
«_Superman_»19-Oct-09 5:32
professional«_Superman_»19-Oct-09 5:32 
GeneralRe: IHTMLDocument2 for Table Par Pin
NaveenHS20-Oct-09 2:21
NaveenHS20-Oct-09 2:21 
QuestionC++ Pin
john curtin14-Oct-09 23:46
john curtin14-Oct-09 23:46 
AnswerRe: C++ Pin
Richard MacCutchan15-Oct-09 0:00
mveRichard MacCutchan15-Oct-09 0:00 
AnswerRe: C++ Pin
CPallini15-Oct-09 0:06
mveCPallini15-Oct-09 0:06 
GeneralRe: C++ Pin
Richard MacCutchan15-Oct-09 0:35
mveRichard MacCutchan15-Oct-09 0:35 
GeneralRe: C++ Pin
Tim Craig15-Oct-09 19:06
Tim Craig15-Oct-09 19:06 
QuestionI/O files Pin
programmer20214-Oct-09 23:26
programmer20214-Oct-09 23:26 
Hello to everyone.

I want to read line by line an input file (leer_datos).

In the input file (leer_datos): If the first character of each line is '|', then I copy the whole line and paste it in an output file (escribir_datos).
In the input file (leer_datos): If the first character isn´t '|' then I go to the next line in the input file (leer_datos).

My code:
#include <stdio.h>;

int main(void)
{

    FILE *leer_datos, *escribir_datos;
    char muestra[50];

	leer_datos = fopen("input_file.txt", "rt"); 
    escribir_datos = fopen("output_file.txt", "wt");

	while ( (!feof(leer_datos)) && (!ferror(leer_datos)) ) 

	{
		muestra = getc(leer_datos) ;
		if (muestra == '|')  
		     {
			  fgets(muestra, sizeof(muestra), leer_datos); 
              fputs(muestra, escribir_datos);
			  fputs("\n", escribir_datos);
		     }
	
   
	}

	if (fclose(leer_datos) != 0)
		printf ("Hay problemas al cerrar el fichero de lectura de datos\n");  

    if (fclose(escribir_datos) != 0)
		printf ("Hay problemas al cerrar el fichero de escritura de datos\n");    

}





...but it gives some errors and I don´t sure about it works fine.
Anyone could help me, please!?.
AnswerRe: I/O files Pin
Richard MacCutchan14-Oct-09 23:38
mveRichard MacCutchan14-Oct-09 23:38 
QuestionRe: I/O files Pin
David Crow15-Oct-09 3:20
David Crow15-Oct-09 3:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.