Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: problem in priniting new line in a logfile

Author: Uri Blass

Date: 04:44:11 11/11/03

Go up one level in this thread


On November 11, 2003 at 07:36:50, Uri Blass wrote:

>On November 11, 2003 at 06:40:54, José Carlos wrote:
>
>>On November 11, 2003 at 06:31:56, Uri Blass wrote:
>>
>>>I try to generate a logfile for movei and I have a problem when I try to write a
>>>new line because for some reason fprintf does not give me a new line
>>>
>>>fprintf(logmovei,"\n"); does not help when I have no problem to write my name in
>>>the logfile by fprintf(logmovei,"uri");
>>>
>>>The point is that I want to see the moves easily in the logfile and I also want
>>>to have the exact number of nodes during playing and during pondering in order
>>>to help me to reproduce the exact conditions.
>>>
>>>I do not like to see something like
>>>something like 1.e4 e5 nodes=1 2.a3 d5 nodes=4826432 3.b3 nodes=299100 Nf6
>>>nodes=39999999
>>>
>>>I can do it by writing the right number of spaces but I do not like to calculate
>>>the number of spaces that I need to add only to write a new line in the logfile.
>>>
>>>Uri
>>
>>  How do you open the file?
>>  I open it:
>>
>>	pFLog = fopen(szLog,"w");
>>	setbuf(pFLog,NULL);
>>
>>  Where szLog is the name of the file.
>>
>>  José C.
>
>
>I opened it to write at the end by
>
>logmovei=fopen(logstring,"a+b");
>fseek(logmovei,0,SEEK_END);
>
>I can print every char and varaibles by
>fprintf(logmovei, ".");
>fprintf(logmovei,"%s",buffer);
>fprintf(logmovei," nodes= %d",nodes);
>
>when I finish I close the file by
>
>fclose(logmovei);
>
>Uri

I can add that
I have strcpy(logstring,"moveloginfo0.log");

I also have global varaibles
FILE * logmovei;
char logstring[20];

logstring[20] includes the name of the logfile and I want to have more than one
option about it.

Maybe I need to have .txt and not .log and I will check if this is the problem
Another possibility is that I need to open it differently.

Uri



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.