I am getting an error with this code. 'Incompatible types inassignment of char to char13' I can't figure out how to initializethese arrays and make this work. Basically, the program takes ISBNcodes (4 groups of integers and makes one string with '-' in thembetween each group of numbers) and verifies that they are correct. Theprogram uses a class ISBN and a main function that loads the actualISBN codes and tries to use the class ISBN to test them. Here is whatI have.class ISBN private:char group6;char publisher8;char book8;char check;char.
Quote how can I cast either the 'LeftStr(sSomeVar, 1)' or the 'A'.' Z' so that they are compatible. sSomeVar:= 'ABC Carpet'; if not (LeftStr(sSomeVar, 1) in 'A'.'
Thu Apr 28, 2016 5:25 pm #46410 Done. Completed it Thank you Mr.Martin, you were right, a single serial port in esp8266, either connects to serial monitor or connects with arduino. Error: incompatible types when assigning to type 'char20'. 20 from type char. studentmark.passfail='DISTINCTION n'; Why is this? Best How To: You shall not use = operator while copying strings. You need to use strcpy. For your reference, the studentmark.passfail is a statically allocated array.
Z') then Thanks, KeithThe compiler already tells you what the problem is. LeftStr returns astring, and you can't compare that with a Char, even if it only containsone character.So you need a Char. Luckily, strings can be accessed as regular characterarrays (index starts at 1, of course), so:if (sSomeVar ') and(sSomeVar1 in 'A'.' Z') thenThis works because sSomeVar1 is of type Char. Note that you must checkif sSomeVar is not empty, since range checking would complain if youtried to access sSomeVar1 on an empty string.-Rudy Velthuis TeamB friendship founded on business is better than a business founded onfriendship.' Rockefeller (1874-1960). Quote how can I cast either the 'LeftStr(sSomeVar, 1)' or the 'A'.'
Z' so that they are compatible. sSomeVar:= 'ABC Carpet'; if not (LeftStr(sSomeVar, 1) in 'A'.' Z') then Thanks, KeithThe compiler already tells you what the problem is. LeftStr returns astring, and you can't compare that with a Char, even if it only containsone character.So you need a Char.
Luckily, strings can be accessed as regular characterarrays (index starts at 1, of course), so:if (sSomeVar ') and(sSomeVar1 in 'A'.' Z') thenThis works because sSomeVar1 is of type Char. Note that you must checkif sSomeVar is not empty, since range checking would complain if youtried to access sSomeVar1 on an empty string.-Rudy Velthuis TeamB friendship founded on business is better than a business founded onfriendship.' Rockefeller (1874-1960). Quote Keith G Hicks wrote: Thanks Rudy. I didn't know about using the sSomeVar1 construct.
Very cool little tip. Any idea where I can find info on that in the D7 help file? I'd like to read about it.Delphi HelpContentsDelphi Language GuideData types, variables and constantsString typesAbout string types.