<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Kann den Fehler nicht finden &amp;quot;case-Marke reduziert nicht auf Ganzzahlkonstante&amp;quot;]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>brauche da mal wieder eure Hilfe. Das Programm hatte ich schon einmal unter Kubuntu7.04 compiliert. Jetzt unter Ubuntu8.04 erhalte ich folgende Meldung:</p>
<pre><code>trafficd.c: In Funktion »addr_chk«:
trafficd.c:207: Fehler: switch-Größe ist keine Ganzzahl
trafficd.c:209: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:211: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:213: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:215: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:217: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:219: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:221: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:223: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:225: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:227: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:229: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:231: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:233: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:235: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:237: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:239: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:241: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:243: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:245: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:247: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:249: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:251: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:253: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:255: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
</code></pre>
<p>Der Code sieht so aus:</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
//#include &lt;unistd.h&gt;
#include &lt;signal.h&gt;
#include &lt;math.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/time.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;mysql/mysql.h&gt;
#include &quot;daemonize.h&quot;
#include &quot;trafficd.h&quot;

// *****************************************************************
// Defines
#define			router	0x056FA8C0  // 192.168.111.5
#define			server	0x876FA8C0  // 192.168.111.135

// *****************************************************************
// Globals
int 			sock;
MYSQL 			mysql;

// *****************************************************************
// Main Programm
int main (int argc, char *argv[])
{
int 				bytes, i, c, daemon;
struct 				sockaddr_in my_addr;
unsigned char 		srcaddr[20], dstaddr[20], cpQuery[200];
double				dBootTime;
struct rFlow		Flow;
extern char 		*optarg;
extern int 			optind, opterr, optopt;
unsigned long		FirstTime, LastTime;

// Parameter abfrage
daemon = 1;
while ((c = getopt(argc, argv, &quot;p:c:dh&quot;)) != -1)
{
	switch (c)
	{
	case 'p':
		// pid file *todo*
		break;
	case 'c':
		// config file *todo*
		break;
	case 'd':
		daemon = 0;
		break;
	case 'h':
		usage();
		return 0;
	default:
		fprintf(stderr, &quot;Ungültige CommandLine Option.\n&quot;);
		exit(1);
	}
}

if (daemon) daemonize();

signal(SIGTERM,signal_handler); /* catch kill signal */
signal(SIGINT,signal_handler); /* catch kill signal */

memset(&amp;my_addr, 0, sizeof(my_addr));			// alles mit Nullen füllen
my_addr.sin_family      = AF_INET;                   // muss hier nochmal stehen
my_addr.sin_port        = htons(2055);               // auf dem Port läuft NetFlow
my_addr.sin_addr.s_addr = htonl(INADDR_ANY);

// socket anlegen
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
{
	perror(&quot;couldn't create socket\n&quot;);
    exit(1);
}

// binden
if (bind(sock, (struct sockaddr *)&amp;my_addr, sizeof(struct sockaddr)) == -1)
{
	perror(&quot;couldn't bind\n&quot;);
	exit(2);
}

// MySQL Connecten
mysql_init(&amp;mysql);
mysql_real_connect(&amp;mysql, &quot;localhost&quot;, &quot;root&quot;, &quot;linuxfun&quot;, &quot;rflow&quot;, 0, NULL, 0);

// Hauptschleife
for(;;)
{
	if ((bytes = recvfrom(sock, (void *)&amp;Flow, sizeof(struct rFlow), 0, NULL, NULL)) == -1)
	{
		perror(&quot;couldn't recvfrom\n&quot;);
	}

   	// unixtime beim start des routers
   	dBootTime = (double)ntohl(Flow.unix_secs)+((double)ntohl(Flow.unix_nsecs)/1000000000)-((double)ntohl(Flow.SysUptime)/1000);

//	printf(&quot;Länge: %u bytes, Version: %u, Count: %u, UpTime: %u min, unix_secs: %u sec.\n&quot;,
//	bytes, ntohs(Flow.Version), ntohs(Flow.RecordCount), ntohl(Flow.SysUptime)/1000/60, ntohl(Flow.unix_secs));

	for (i=0;i&lt;ntohs(Flow.RecordCount); i++)
	{

		if (addr_chk(Flow.FlowRecs[i].srcaddr) &amp;&amp; !((Flow.FlowRecs[i].srcaddr == router) &amp;&amp; (Flow.FlowRecs[i].dstaddr == server) &amp;&amp; (ntohs(Flow.FlowRecs[i].dstport) == 2055)))
		{
			num2ip(ntohl(Flow.FlowRecs[i].srcaddr), srcaddr);
			num2ip(ntohl(Flow.FlowRecs[i].dstaddr), dstaddr);

			FirstTime = (unsigned long int)(dBootTime + ((double)ntohl(Flow.FlowRecs[i].First)/1000));
			LastTime =  (unsigned long int)(dBootTime + ((double)ntohl(Flow.FlowRecs[i].Last )/1000));
			fix_time_bug(&amp;FirstTime, &amp;LastTime);

			sprintf(cpQuery, &quot;INSERT INTO flows (ipSrc, ipDst, srcPort, dstPort, pktSent, bytesSent, proto, startTime, endTime, tcpFlags, tos) &quot;
							 &quot;VALUES ('%s', '%s', %u, %u, %u, %u, %u, FROM_UNIXTIME(%lu), FROM_UNIXTIME(%lu), %u, %u)&quot;,
							 srcaddr, dstaddr,
							 ntohs(Flow.FlowRecs[i].srcport), ntohs(Flow.FlowRecs[i].dstport),
							 ntohl(Flow.FlowRecs[i].dPkts), ntohl(Flow.FlowRecs[i].dOctets),
							 Flow.FlowRecs[i].prot,
							 FirstTime,
							 LastTime,
							 Flow.FlowRecs[i].tcp_flags, Flow.FlowRecs[i].tos);

			if(mysql_real_query(&amp;mysql, cpQuery, strlen(cpQuery)))
			{
				perror(&quot;MySQL Query fehlgeschlagen\n&quot;);
			}
		}
	}

	printf(&quot;\n&quot;);
}
close(sock); // wir schließen den socket wieder
mysql_close(&amp;mysql);

return 0;
}

// *****************************************************************
// Fix DD-WRTs time bug
void fix_time_bug(unsigned long *FirstTime, unsigned long *LastTime)
{
	unsigned long timedif;
	struct timeval tv;
	gettimeofday(&amp;tv, NULL);

	timedif = (unsigned long)ceil((float)(*LastTime - tv.tv_sec)/3600) * 3600;

	*FirstTime -= timedif;
	*LastTime -= timedif;

}

// *****************************************************************
// Number 2 IP (xx.xx.xx.xx)
void num2ip(unsigned long int num, char *ip)
//void num2ip(int num, char *ip)
{
	sprintf(ip, &quot;%lu.%lu.%lu.%lu&quot;,(num&amp;0xff000000)&gt;&gt;24, (num&amp;0x00ff0000)&gt;&gt;16, (num&amp;0x0000ff00)&gt;&gt;8, (num&amp;0x000000ff));
}

// *****************************************************************
// Signal Handler
void signal_handler(int sig)
{
	switch(sig)
	{
	case SIGTERM:
	case SIGINT:
		printf(&quot;trafficd stopping....\n&quot;);
		mysql_close(&amp;mysql); // MySQL Schließen
		close(sock); // wir schließen den socket wieder
		printf(&quot;trafficd stopped.\n&quot;);
		exit(0);
		break;
	}
}

// *****************************************************************
// Hilfe Text
void usage()
{
	fprintf(stderr, &quot;Copyright (C) 2006 Ing. Markus Flattinger\n&quot;);
	fprintf(stderr, &quot;Usage: trafficd [optionen]\n&quot;);
	fprintf(stderr, &quot;Gültige CommandLine Optionen:\n&quot;);
	fprintf(stderr, &quot;  -p path         pid file path (default: /var/run)\n&quot;);
	fprintf(stderr, &quot;  -c path         Configuration file (default: /etc)\n&quot;);
	fprintf(stderr, &quot;  -d              Debug Modus, nicht forken und debug Meldungen ausgeben\n&quot;);
	fprintf(stderr, &quot;  -h              Display this help\n&quot;);
	fprintf(stderr, &quot;\n&quot;);
}

// *****************************************************************
// addr_chk
int addr_chk(unsigned char addr[])
{
	switch (addr)
	{
	case &quot;192.168.111.90&quot;:
		return 1;
	case &quot;192.168.111.133&quot;:
		return 1;
	case &quot;192.168.111.4&quot;:
		return 1;
	case &quot;192.168.111.8&quot;:
		return 1;
	case &quot;192.168.111.9&quot;:
		return 1;
	case &quot;192.168.111.11&quot;:
		return 1;
	case &quot;192.168.111.12&quot;:
		return 1;
	case &quot;192.168.111.13&quot;:
		return 1;
	case &quot;192.168.111.14&quot;:
		return 1;
	case &quot;192.168.111.15&quot;:
		return 1;
	case &quot;192.168.111.16&quot;:
		return 1;
	case &quot;192.168.111.17&quot;:
		return 1;
	case &quot;192.168.111.18&quot;:
		return 1;
	case &quot;192.168.111.19&quot;:
		return 1;
	case &quot;192.168.111.31&quot;:
		return 1;
	case &quot;192.168.111.32&quot;:
		return 1;
	case &quot;192.168.111.33&quot;:
		return 1;
	case &quot;192.168.111.35&quot;:
		return 1;
	case &quot;192.168.111.37&quot;:
		return 1;
	case &quot;192.168.111.38&quot;:
		return 1;
	case &quot;192.168.111.41&quot;:
		return 1;
	case &quot;192.168.111.42&quot;:
		return 1;
	case &quot;192.168.111.43&quot;:
		return 1;
	case &quot;192.168.111.125&quot;:
		return 1;
	default:
		return 0;
	}
}
</code></pre>
<p>Wo liegt hier der Fehler?<br />
Gruß Bernd</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/244712/kann-den-fehler-nicht-finden-quot-case-marke-reduziert-nicht-auf-ganzzahlkonstante-quot</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 04:00:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/244712.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Jul 2009 15:46:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Kann den Fehler nicht finden &amp;quot;case-Marke reduziert nicht auf Ganzzahlkonstante&amp;quot; on Sat, 04 Jul 2009 15:46:07 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>brauche da mal wieder eure Hilfe. Das Programm hatte ich schon einmal unter Kubuntu7.04 compiliert. Jetzt unter Ubuntu8.04 erhalte ich folgende Meldung:</p>
<pre><code>trafficd.c: In Funktion »addr_chk«:
trafficd.c:207: Fehler: switch-Größe ist keine Ganzzahl
trafficd.c:209: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:211: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:213: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:215: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:217: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:219: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:221: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:223: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:225: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:227: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:229: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:231: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:233: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:235: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:237: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:239: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:241: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:243: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:245: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:247: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:249: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:251: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:253: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
trafficd.c:255: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
</code></pre>
<p>Der Code sieht so aus:</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
//#include &lt;unistd.h&gt;
#include &lt;signal.h&gt;
#include &lt;math.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/time.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;mysql/mysql.h&gt;
#include &quot;daemonize.h&quot;
#include &quot;trafficd.h&quot;

// *****************************************************************
// Defines
#define			router	0x056FA8C0  // 192.168.111.5
#define			server	0x876FA8C0  // 192.168.111.135

// *****************************************************************
// Globals
int 			sock;
MYSQL 			mysql;

// *****************************************************************
// Main Programm
int main (int argc, char *argv[])
{
int 				bytes, i, c, daemon;
struct 				sockaddr_in my_addr;
unsigned char 		srcaddr[20], dstaddr[20], cpQuery[200];
double				dBootTime;
struct rFlow		Flow;
extern char 		*optarg;
extern int 			optind, opterr, optopt;
unsigned long		FirstTime, LastTime;

// Parameter abfrage
daemon = 1;
while ((c = getopt(argc, argv, &quot;p:c:dh&quot;)) != -1)
{
	switch (c)
	{
	case 'p':
		// pid file *todo*
		break;
	case 'c':
		// config file *todo*
		break;
	case 'd':
		daemon = 0;
		break;
	case 'h':
		usage();
		return 0;
	default:
		fprintf(stderr, &quot;Ungültige CommandLine Option.\n&quot;);
		exit(1);
	}
}

if (daemon) daemonize();

signal(SIGTERM,signal_handler); /* catch kill signal */
signal(SIGINT,signal_handler); /* catch kill signal */

memset(&amp;my_addr, 0, sizeof(my_addr));			// alles mit Nullen füllen
my_addr.sin_family      = AF_INET;                   // muss hier nochmal stehen
my_addr.sin_port        = htons(2055);               // auf dem Port läuft NetFlow
my_addr.sin_addr.s_addr = htonl(INADDR_ANY);

// socket anlegen
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
{
	perror(&quot;couldn't create socket\n&quot;);
    exit(1);
}

// binden
if (bind(sock, (struct sockaddr *)&amp;my_addr, sizeof(struct sockaddr)) == -1)
{
	perror(&quot;couldn't bind\n&quot;);
	exit(2);
}

// MySQL Connecten
mysql_init(&amp;mysql);
mysql_real_connect(&amp;mysql, &quot;localhost&quot;, &quot;root&quot;, &quot;linuxfun&quot;, &quot;rflow&quot;, 0, NULL, 0);

// Hauptschleife
for(;;)
{
	if ((bytes = recvfrom(sock, (void *)&amp;Flow, sizeof(struct rFlow), 0, NULL, NULL)) == -1)
	{
		perror(&quot;couldn't recvfrom\n&quot;);
	}

   	// unixtime beim start des routers
   	dBootTime = (double)ntohl(Flow.unix_secs)+((double)ntohl(Flow.unix_nsecs)/1000000000)-((double)ntohl(Flow.SysUptime)/1000);

//	printf(&quot;Länge: %u bytes, Version: %u, Count: %u, UpTime: %u min, unix_secs: %u sec.\n&quot;,
//	bytes, ntohs(Flow.Version), ntohs(Flow.RecordCount), ntohl(Flow.SysUptime)/1000/60, ntohl(Flow.unix_secs));

	for (i=0;i&lt;ntohs(Flow.RecordCount); i++)
	{

		if (addr_chk(Flow.FlowRecs[i].srcaddr) &amp;&amp; !((Flow.FlowRecs[i].srcaddr == router) &amp;&amp; (Flow.FlowRecs[i].dstaddr == server) &amp;&amp; (ntohs(Flow.FlowRecs[i].dstport) == 2055)))
		{
			num2ip(ntohl(Flow.FlowRecs[i].srcaddr), srcaddr);
			num2ip(ntohl(Flow.FlowRecs[i].dstaddr), dstaddr);

			FirstTime = (unsigned long int)(dBootTime + ((double)ntohl(Flow.FlowRecs[i].First)/1000));
			LastTime =  (unsigned long int)(dBootTime + ((double)ntohl(Flow.FlowRecs[i].Last )/1000));
			fix_time_bug(&amp;FirstTime, &amp;LastTime);

			sprintf(cpQuery, &quot;INSERT INTO flows (ipSrc, ipDst, srcPort, dstPort, pktSent, bytesSent, proto, startTime, endTime, tcpFlags, tos) &quot;
							 &quot;VALUES ('%s', '%s', %u, %u, %u, %u, %u, FROM_UNIXTIME(%lu), FROM_UNIXTIME(%lu), %u, %u)&quot;,
							 srcaddr, dstaddr,
							 ntohs(Flow.FlowRecs[i].srcport), ntohs(Flow.FlowRecs[i].dstport),
							 ntohl(Flow.FlowRecs[i].dPkts), ntohl(Flow.FlowRecs[i].dOctets),
							 Flow.FlowRecs[i].prot,
							 FirstTime,
							 LastTime,
							 Flow.FlowRecs[i].tcp_flags, Flow.FlowRecs[i].tos);

			if(mysql_real_query(&amp;mysql, cpQuery, strlen(cpQuery)))
			{
				perror(&quot;MySQL Query fehlgeschlagen\n&quot;);
			}
		}
	}

	printf(&quot;\n&quot;);
}
close(sock); // wir schließen den socket wieder
mysql_close(&amp;mysql);

return 0;
}

// *****************************************************************
// Fix DD-WRTs time bug
void fix_time_bug(unsigned long *FirstTime, unsigned long *LastTime)
{
	unsigned long timedif;
	struct timeval tv;
	gettimeofday(&amp;tv, NULL);

	timedif = (unsigned long)ceil((float)(*LastTime - tv.tv_sec)/3600) * 3600;

	*FirstTime -= timedif;
	*LastTime -= timedif;

}

// *****************************************************************
// Number 2 IP (xx.xx.xx.xx)
void num2ip(unsigned long int num, char *ip)
//void num2ip(int num, char *ip)
{
	sprintf(ip, &quot;%lu.%lu.%lu.%lu&quot;,(num&amp;0xff000000)&gt;&gt;24, (num&amp;0x00ff0000)&gt;&gt;16, (num&amp;0x0000ff00)&gt;&gt;8, (num&amp;0x000000ff));
}

// *****************************************************************
// Signal Handler
void signal_handler(int sig)
{
	switch(sig)
	{
	case SIGTERM:
	case SIGINT:
		printf(&quot;trafficd stopping....\n&quot;);
		mysql_close(&amp;mysql); // MySQL Schließen
		close(sock); // wir schließen den socket wieder
		printf(&quot;trafficd stopped.\n&quot;);
		exit(0);
		break;
	}
}

// *****************************************************************
// Hilfe Text
void usage()
{
	fprintf(stderr, &quot;Copyright (C) 2006 Ing. Markus Flattinger\n&quot;);
	fprintf(stderr, &quot;Usage: trafficd [optionen]\n&quot;);
	fprintf(stderr, &quot;Gültige CommandLine Optionen:\n&quot;);
	fprintf(stderr, &quot;  -p path         pid file path (default: /var/run)\n&quot;);
	fprintf(stderr, &quot;  -c path         Configuration file (default: /etc)\n&quot;);
	fprintf(stderr, &quot;  -d              Debug Modus, nicht forken und debug Meldungen ausgeben\n&quot;);
	fprintf(stderr, &quot;  -h              Display this help\n&quot;);
	fprintf(stderr, &quot;\n&quot;);
}

// *****************************************************************
// addr_chk
int addr_chk(unsigned char addr[])
{
	switch (addr)
	{
	case &quot;192.168.111.90&quot;:
		return 1;
	case &quot;192.168.111.133&quot;:
		return 1;
	case &quot;192.168.111.4&quot;:
		return 1;
	case &quot;192.168.111.8&quot;:
		return 1;
	case &quot;192.168.111.9&quot;:
		return 1;
	case &quot;192.168.111.11&quot;:
		return 1;
	case &quot;192.168.111.12&quot;:
		return 1;
	case &quot;192.168.111.13&quot;:
		return 1;
	case &quot;192.168.111.14&quot;:
		return 1;
	case &quot;192.168.111.15&quot;:
		return 1;
	case &quot;192.168.111.16&quot;:
		return 1;
	case &quot;192.168.111.17&quot;:
		return 1;
	case &quot;192.168.111.18&quot;:
		return 1;
	case &quot;192.168.111.19&quot;:
		return 1;
	case &quot;192.168.111.31&quot;:
		return 1;
	case &quot;192.168.111.32&quot;:
		return 1;
	case &quot;192.168.111.33&quot;:
		return 1;
	case &quot;192.168.111.35&quot;:
		return 1;
	case &quot;192.168.111.37&quot;:
		return 1;
	case &quot;192.168.111.38&quot;:
		return 1;
	case &quot;192.168.111.41&quot;:
		return 1;
	case &quot;192.168.111.42&quot;:
		return 1;
	case &quot;192.168.111.43&quot;:
		return 1;
	case &quot;192.168.111.125&quot;:
		return 1;
	default:
		return 0;
	}
}
</code></pre>
<p>Wo liegt hier der Fehler?<br />
Gruß Bernd</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1737066</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1737066</guid><dc:creator><![CDATA[bernd_h_schulz]]></dc:creator><pubDate>Sat, 04 Jul 2009 15:46:07 GMT</pubDate></item><item><title><![CDATA[Reply to Kann den Fehler nicht finden &amp;quot;case-Marke reduziert nicht auf Ganzzahlkonstante&amp;quot; on Sat, 04 Jul 2009 15:49:14 GMT]]></title><description><![CDATA[<p>Lies die Fehlermeldung. Deutlicher geht's kaum.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1737069</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1737069</guid><dc:creator><![CDATA[SG1]]></dc:creator><pubDate>Sat, 04 Jul 2009 15:49:14 GMT</pubDate></item><item><title><![CDATA[Reply to Kann den Fehler nicht finden &amp;quot;case-Marke reduziert nicht auf Ganzzahlkonstante&amp;quot; on Sat, 04 Jul 2009 18:09:40 GMT]]></title><description><![CDATA[<p>Du versuchst in deiner Switch-Anweisung auf einen String zu prüfen. Alles was zwischen &quot;&quot; ist, ist ein String, alles was zwischen '' steht, ist vom Typ Char. In einer Switch-Anweisung kannst du nur Integerwerte prüfen. Somit kannst du also nur auf ein einzelnes Char Byte, Integerzahlen, Boolwerte(was wenig Sinn macht, aber funktioniert) und auf Enumwerte.<br />
Folglich musst du If-Verzweigungen benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1737125</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1737125</guid><dc:creator><![CDATA[freaky]]></dc:creator><pubDate>Sat, 04 Jul 2009 18:09:40 GMT</pubDate></item><item><title><![CDATA[Reply to Kann den Fehler nicht finden &amp;quot;case-Marke reduziert nicht auf Ganzzahlkonstante&amp;quot; on Sat, 04 Jul 2009 18:28:45 GMT]]></title><description><![CDATA[<p>FreakY&lt;3Cpp schrieb:</p>
<blockquote>
<p>Folglich musst du If-Verzweigungen benutzen.</p>
</blockquote>
<p>Oder <code>std::map</code> . Wobei hier auch <code>std::set</code> reicht - wenn eine Adresse im Set vorkommt, gibst du 1 zurück, sonst 0.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1737136</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1737136</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sat, 04 Jul 2009 18:28:45 GMT</pubDate></item><item><title><![CDATA[Reply to Kann den Fehler nicht finden &amp;quot;case-Marke reduziert nicht auf Ganzzahlkonstante&amp;quot; on Mon, 06 Jul 2009 07:31:53 GMT]]></title><description><![CDATA[<p>... oder alternativ ein statisches char const * Array und ein std::find(). Ggfs. könnte man die Werte auch sortiert in dem Array ablegen und dann mit binary_search() arbeiten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1737731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1737731</guid><dc:creator><![CDATA[jencas]]></dc:creator><pubDate>Mon, 06 Jul 2009 07:31:53 GMT</pubDate></item><item><title><![CDATA[Reply to Kann den Fehler nicht finden &amp;quot;case-Marke reduziert nicht auf Ganzzahlkonstante&amp;quot; on Mon, 06 Jul 2009 15:26:49 GMT]]></title><description><![CDATA[<p>Man könnte auch den IP-String erstmal parsen, und dann switch() oder ein set&lt;uint32_t&gt; verwenden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1738004</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1738004</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Mon, 06 Jul 2009 15:26:49 GMT</pubDate></item></channel></rss>