[ create a new paste ] login | about

Link: http://codepad.org/mT6IaGkV    [ raw code | fork ]

C, pasted on Feb 22:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
int main() {
	char str[100];
	FILE *fp;
	int i, j;

	fp = fopen("smpl.txt", "r");
	fgets(str, sizeof(str), fp);
	i = j = 0;
	while (str[i] != '\0') {
		if (str[i] == '\\' && str[i+1] == 'n') {
			str[j++] = '\n';
			i += 2;
		} else {
			str[j++] = str[i++];
		}
	}
	str[j] = '\0';
	printf("%s", str);
}


Create a new paste based on this one


Comments: