vl4kn0 17 Light Poster

on 36. line you have fp = open(argv[2], "r"); it should be fp = fopen(argv[2], "r");
Else you have declared variable char line[MAXSIZE]; but you don't use it in your code.

thanatosys commented: great help on a simple problem. +1
vl4kn0 17 Light Poster
#include <stdio.h>
 
int main(void)
{
	int sec_code;
	scanf("%d", &sec_code);
	
	while(sec_code < 1 || sec_code > 4) {
		printf("Ivalid value entered. Must be 1 to 4, please re-enter: ");
		scanf("%d", &sec_code);
	}
}

No if statement, no break. Is it what do you want?

vl4kn0 17 Light Poster
#include <stdio.h>

int main(void)
{
	int sec_code = 0;
	while(sec_code < 1 || sec_code > 4) {
		scanf("%d", &sec_code);
		if(sec_code < 1 || sec_code > 4) {
			printf("Ivalid value entered. Must be 1 to 4, please re-enter: ");
		}
	}
}
WaltP commented: A WHILE loop is not a POSTtest loop +15
vl4kn0 17 Light Poster

Ou. Yes of course should be $vardata. Thanks for correction. But I can't edit my post after 30 minutes :(

vl4kn0 17 Light Poster

In my opinion is much better tu use something like this:

Template.class.php:

<?php

class Template
{
	private $tpl_data = array();
	private $file;
	
	function __construct($filename)
	{
		// Load file into $file var
		$this->file = implode('', @file($filename));
	}
	
	public function assign($vardata)
	{
		// Load var array into $tpl_data
		foreach($vars as $key => $value) {
			$this->tpl_data[$key] = $value;
		}
	}
	
	public function run()
	{
		// replace {$key} into $value
		foreach($this->tpl_data as $key => $value) {
			$this->file = str_replace('{' . $key . '}', $value, $this->file);
			echo $this->file;
		}
	}
}

?>

template.html

<html>
  <head>
    <title>{TITLE}</title>
  </head>
  <body>
    <h1>{WELCOME}</h1>
  </body>
</html>

show_page.php

<?php

$tpl = new Template("template.html");
$tpl->assign(array(
	'TITLE' => 'Just a test',
	'WELCOME' => 'Welcome on our pages'
));
$tpl->run();

?>
vl4kn0 17 Light Poster

def Step: must by def Step(): and else I don't know :)