Author: Joost Buijs
Date: 04:47:49 08/14/03
Go up one level in this thread
On August 14, 2003 at 07:03:25, Tim Foden wrote:
>On August 14, 2003 at 06:43:38, Joost Buijs wrote:
>
>>You can try something like this:
>>
>>#include <stdio.h>
>>#include <stdlib.h>
>>#include <string.h>
>>
>>int queens[9][2];
>>int rooks[10][2];
>>int bishops[10][2];
>>int knights[10][2];
>>int pawns[8][2];
>>
>>void WriteArrays(int nodes)
>>{
>> char fname[14];
>> FILE *fp;
>>
>> sprintf(fname,"Movei%d.d",nodes);
>
>Possible buffer overrun here... nodes my well be > 9999 :) Looking at other
>posts of Uri's, numbers like "213,298,603" were quoted. Safer maybe to make
>fname at least 20 chars long. (same problem in CompareArray() too.)
>
>Cheers, Tim.
You are right ofcause, but with the ".d" extension nodes can go to 999999.
5 chars for "Movei" 2 for ".d" and 1 for the trailing zero, so 6 chars remain.
But it is indeed saver to increase the buffer size somewhat.
Joost
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.