I'd also consider re-writing clear buffer to take a (char *c) parameter,
like this:
void clearBuffer(*char** buffer, int bufferSize){ //Fills the buffer with
0x00
for(int i=0; i<bufferSize; i++){
* buffer[i] = '\0';*
}
}
On Tue, Oct 15, 2019 at 10:07 AM Dan Higdon <[email protected]> wrote:
> A couple of notes:
> After line 191 (term = i;), insert a break statement. This may actually
> fix the extra null problem.
>
> Change the declaration of the parameter in 147 to (char const * c). Do the
> same on line 98. This will silence a lot of the warnings.
>
> On Tue, Oct 15, 2019 at 5:45 AM Brian K. White <[email protected]> wrote:
>
>> I'll do some more methodical testing to try to duplicate.
>> --
>> bkw
>>
>> On 10/15/19 4:55 AM, Gary Hammond wrote:
>> >
>> > With the code for sd2tpdd from GitHub, the compiler was issuing the
>> > warnings below. I have gone through and corrected them and the
>> > compiler is now happy and the randomness in the first 2 characters is
>> > less random. They are still garbage characters but now they are nearly
>> > consistently the same garbage for a given file.
>> >
>> > For example, for 3 runs of the load/save of the same file, I got the
>> > following first 2 bytes (hex)
>> >
>> > 5C 89
>> >
>> > 97 8A
>> >
>> > 5C 89
>> >
>> > On a different file I got 1B 8A
>> >
>> > The compiler warnings were:
>> >
>> > 184:33: warning: invalid conversion from 'char*' to 'byte* {aka
>> > unsigned char*}' [-fpermissive]
>> >
>> > 92:6: note: initializing argument 1 of 'void clearBuffer(byte*, int)'
>> >
>> > 253:30: warning: ISO C++ forbids converting a string constant to
>> > 'char*' [-Wwrite-strings]
>> >
>> > 379:28: warning: ISO C++ forbids converting a string constant to
>> > 'char*' [-Wwrite-strings]
>> >
>> > 473:24: warning: ISO C++ forbids converting a string constant to
>> > 'char*' [-Wwrite-strings]
>> >
>> > 498:24: warning: ISO C++ forbids converting a string constant to
>> > 'char*' [-Wwrite-strings]
>> >
>> > 522:34: warning: ISO C++ forbids converting a string constant to
>> > 'char*' [-Wwrite-strings]
>> >
>> > The NULL character is still being appended to the end of the fileā¦no
>> > luck so far chasing that one down.
>> >
>> > To help with those who can confirm that they have their board working
>> > fine, I am using Arduino 1.8.10 for build and upload.
>> >
>> > The GitHub page for the source I am using is
>> > https://github.com/TangentDelta/SD2TPDD in case I am using the wrong
>> one.
>> >
>> > I have now tried my 2 slightly suspect AliExpress Arduino Mega clones
>> > and various combinations of el cheapo SD card readers and shop bought
>> > ones. The genuine Arduino Mega I ordered from arduino.cc arrived today
>> > so have swapped out the clones for the genuine article and still no
>> luck.
>> >
>>
>>