You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Geert Vancompernolle <ge...@gmail.com> on 2023/05/21 14:04:42 UTC

C/C++ plug-in: no linefeed in output window

Just started today using the C/C++ plug-in.  Got it from NB8.2 since the 
plug-in has not been updated (yet?) for more recent NB's.

All is working fine except that the following commands:

     retval = wiringPiI2CWriteReg8(fd, 0x00, 0x80);
     printf("Writing IODIR_A = [0x%02X].\n", (unsigned int)wiringPiI2CReadReg8(fd, 0x00));
     printf("Reading IODIR_A = [0x%02X].\n", (unsigned int)wiringPiI2CReadReg8(fd, 0x00));
     retval = wiringPiI2CWriteReg8(fd, 0x01, 0x10);
     printf("Writing IODIR_B = [0x%02X].\n", (unsigned int)wiringPiI2CReadReg8(fd, 0x01));
     printf("Reading IODIR_B = [0x%02X].\n", (unsigned int)wiringPiI2CReadReg8(fd, 0x01));

result in the following representation on the output window:

Writing IODIR_A = [0x80].
                          Reading IODIR_A = [0x80].
                                                   Writing IODIR_B = [0x10].
                                                                            Reading IODIR_B = [0x10].


As you can see, the "\n" character used in the printf() statement is not 
translated into "go to beginning of next line".  The next print 
statement simply goes to another line but starts where the previous line 
stopped.

To solve it, I have to add "\r\n" to the printf() statement. Only then 
the next line is also starting at position 1.

Any reason why "\n" is not doing both line feed and carriage return in 
the output window like it does in most other applications?

Font type used in the output window is Courier New.

-- 
Best rgds,
Geert

Re: C/C++ plug-in: no linefeed in output window

Posted by Tim de Vries <te...@gmail.com>.
if it's in the terminal, it's in your processing of out/err. If it's in 
your display, thats your paint/scroll.


tim

On 21/05/2023 8:04 a.m., Geert Vancompernolle wrote:
>
> Just started today using the C/C++ plug-in.  Got it from NB8.2 since 
> the plug-in has not been updated (yet?) for more recent NB's.
>
> All is working fine except that the following commands:
>
>      retval = wiringPiI2CWriteReg8(fd, 0x00, 0x80);
>      printf("Writing IODIR_A = [0x%02X].\n", (unsigned int)wiringPiI2CReadReg8(fd, 0x00));
>      printf("Reading IODIR_A = [0x%02X].\n", (unsigned int)wiringPiI2CReadReg8(fd, 0x00));
>      retval = wiringPiI2CWriteReg8(fd, 0x01, 0x10);
>      printf("Writing IODIR_B = [0x%02X].\n", (unsigned int)wiringPiI2CReadReg8(fd, 0x01));
>      printf("Reading IODIR_B = [0x%02X].\n", (unsigned int)wiringPiI2CReadReg8(fd, 0x01));
>
> result in the following representation on the output window:
>
> Writing IODIR_A = [0x80].
>                           Reading IODIR_A = [0x80].
>                                                    Writing IODIR_B = [0x10].
>                                                                             Reading IODIR_B = [0x10].
>
>
> As you can see, the "\n" character used in the printf() statement is 
> not translated into "go to beginning of next line".  The next print 
> statement simply goes to another line but starts where the previous 
> line stopped.
>
> To solve it, I have to add "\r\n" to the printf() statement. Only then 
> the next line is also starting at position 1.
>
> Any reason why "\n" is not doing both line feed and carriage return in 
> the output window like it does in most other applications?
>
> Font type used in the output window is Courier New.
>
> -- 
> Best rgds,
> Geert