pushrbx icon

Untitled

pushrbx | PRO | 11/02/13 05:03:52 PM UTC | 0 ⭐ | 360 👁️ | Never ⏰ | []
text |

680 B

|

None

|

0 👍

/

0 👎

#include <stdio.h>
#include <string.h>
 #ifndef NULL
#define NULL 0
#endif
 int main(int argc, char *argv[])
{
	// olvassuk be a parancssort:
	char *parancsSoriSzo = NULL;
	if ( argc != 2 )
	{
		printf( "usage: %s filename", argv[0] );
		return 0;
	}
	else
	{
		parancsSoriSzo = argv[1];
	}
 	char *line = NULL;
	size_t size;
 	printf("Irj be egy szoveget: \n");
 	if (!(getline(&line, &size, stdin) == -1))
	{
		// http://www.cplusplus.com/reference/cstring/strstr/
		char *result = strstr(line, parancsSoriSzo);
 		if(result != NULL)
		{
			printf("Szerepel a keresett szo a bevitt szovegben. \n");
		}
	}
	else
	{
		printf("nincs tobb sor");
	}
}

Comments