Benutzer-Werkzeuge

Webseiten-Werkzeuge


becki:linux:c

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
becki:linux:c [2017-12-07 10:01]
becki [> Always use ''stderr'' for debugging messages ((RRUSP p.68))]
becki:linux:c [2017-12-07 14:19] (aktuell)
becki [Definition of constant Strings]
Zeile 90: Zeile 90:
 while (fgets(lin, MAX_LINE_LEN,​ stdin)) {/* do some thing */} while (fgets(lin, MAX_LINE_LEN,​ stdin)) {/* do some thing */}
 </​code>​ </​code>​
 +
 +<note tip>If input line lenght is unknown, use ''​getline()''​ instead of ''​fgets()''​!
 +(See ''​freesigs/​io_modbus''​)</​note>​
  
 ''​scanf''​ can also be used for reading from ''​stdin''​. ''​scanf''​ can also be used for reading from ''​stdin''​.
Zeile 218: Zeile 221:
 [static] const char *mystring= ​ "​String"​ // false, needs 6 Bytes + Pointer [static] const char *mystring= ​ "​String"​ // false, needs 6 Bytes + Pointer
 </​code>​ </​code>​
 +
   * ''​static''​ to limit the scope for global strings. Not necessary inside a code block.   * ''​static''​ to limit the scope for global strings. Not necessary inside a code block.
   * see also [[http://​www.dclc-faq.de/​kap2.htm|de.comp.lang.c FAQ]] -> Frage 2.2 / K&R p.101 / Carm p.124   * see also [[http://​www.dclc-faq.de/​kap2.htm|de.comp.lang.c FAQ]] -> Frage 2.2 / K&R p.101 / Carm p.124
 +  * //​Writable//​ strings must be declared as array (eg ''​char a[]= "​aff";''​) not as pointer. See Carm p 32
  
 === Detailed Description == === Detailed Description ==
becki/linux/c.1512640919.txt.gz · Zuletzt geändert: 2017-12-07 10:01 von becki

Impressum - Datenschutzerklärung