blob: 4c28a7e6bd0694a67b6ea570e1e39b60cb21ff31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// GROUPS passed conversions
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <fstream.h>
extern "C" {
int strncmp (const char *, const char *, size_t);
}
class cvec {
public:
~cvec(){ delete s; }
cvec(const char*x) { s = new char[strlen(x)+1]; strcpy(s, x); }
cvec(const cvec& c) { s = new char[strlen(c.s)+1]; strcpy(s, c.s); }
operator const char*() { return s; }
private:
char *s;
};
cvec
B(const char* a)
{
return a;
}
void
A(const char* s)
{
// s still ok here
ifstream inf(s);
if (strncmp ("aaa", s, 3))
printf ("FAIL\n");
else
printf ("PASS\n");
}
int main()
{
A(B("aaa"));
}
|