Just converted my chess engine from XB to UCI protocol. However when testing manually on Terminal (MacOS) the function getline doesn't accept the lines longer than 1024 characters. Clearly it is not enough for long games.
Is there anything wrong (setup) here? Solution? Thanks.
The below code I have used to check the limit of the function getline:
Are you sure it is not a limit of the MacOS Terminal program or of the way you are trying to input a long line? If a newline somehow creeps into what you are inputting (e.g. by copy and paste), then obviously getline() will stop there.
I think it is the terminal driver. Try to generate a text file with your whole command sequence, i.e. starting with the initial "uci" and "isready". Then add a third line with line length > 1024. Generate debug output in your engine that tells the line length. And then pipe that file into the engine using cat, i.e. "cat ./myfile.txt | ./my_engine".
If it is the terminal, you will see a line length > 1024 in your engine.
I did, it (echo in command line) works well with much longer 1024 characters.
I have created a simple program, compile with MS Visual studio and run with Win 10. The limit is much longer (4096) but still reachable.
Can someone help to test it? Just run below code, copy and paste any string, repeat until the program refuses to show more and then press enter, you will see the length of the string the getline function accepted:
Instead of fighting the limits of the Terminal program, just write another program that outputs a string of a particular length and pipe it to your test program.