Click here to Skip to main content
15,886,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
QuestionMaximum client count of TCP/IP Pin
includeh1014-Oct-09 23:13
includeh1014-Oct-09 23:13 
AnswerRe: Maximum client count of TCP/IP Pin
Richard MacCutchan14-Oct-09 23:40
mveRichard MacCutchan14-Oct-09 23:40 
GeneralRe: Maximum client count of TCP/IP Pin
includeh1014-Oct-09 23:44
includeh1014-Oct-09 23:44 
RantRe: Maximum client count of TCP/IP Pin
Rajesh R Subramanian14-Oct-09 23:56
professionalRajesh R Subramanian14-Oct-09 23:56 
GeneralRe: Maximum client count of TCP/IP Pin
Richard MacCutchan15-Oct-09 0:35
mveRichard MacCutchan15-Oct-09 0:35 
GeneralRe: Maximum client count of TCP/IP Pin
Richard MacCutchan15-Oct-09 0:03
mveRichard MacCutchan15-Oct-09 0:03 
GeneralRe: Maximum client count of TCP/IP Pin
Dan Neely15-Oct-09 2:49
Dan Neely15-Oct-09 2:49 
GeneralRe: Maximum client count of TCP/IP Pin
Richard MacCutchan15-Oct-09 4:34
mveRichard MacCutchan15-Oct-09 4:34 
RantYou are very stupid, indeed. Pin
CPallini15-Oct-09 0:09
mveCPallini15-Oct-09 0:09 
AnswerRe: Maximum client count of TCP/IP Pin
cmk15-Oct-09 3:08
cmk15-Oct-09 3:08 
Question[Message Deleted] Pin
includeh1014-Oct-09 22:52
includeh1014-Oct-09 22:52 
AnswerRe: Client count of TCP/IP [modified] Pin
Rajesh R Subramanian14-Oct-09 23:00
professionalRajesh R Subramanian14-Oct-09 23:00 
GeneralOT Pin
CPallini14-Oct-09 23:03
mveCPallini14-Oct-09 23:03 
GeneralRe: OT Pin
Rajesh R Subramanian14-Oct-09 23:08
professionalRajesh R Subramanian14-Oct-09 23:08 
GeneralRe: Client count of TCP/IP Pin
includeh1014-Oct-09 23:17
includeh1014-Oct-09 23:17 

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.