Sunday, October 18, 2009

OOP344 Assignment 1 compile under Borland C++

I followed the instruction and compiled my code.
I got a lot of error:
warning w8065 test.c 73: call to function 'io_init' with no prototype in function main
many these kind of error.
like all my functions are no prototype.
What should I do under ciol.c?
VCC and LINUX are past already.
Thanks ahead.

OOP344 assignment 1 compile on Matrix

I passed all 10 tests under vcc environment.
I tried to compile the assignment 1 on matrix account.
I use ssh to upload 3 files, test.c, ciol.c, ciol.h
I changed PLATFORM PLT_LNX in ciol.h.
I enter: gcc -o as1 test.c
I got a lot of error.
like this:
ciol.c:618: error: 'F7_KEY' undeclared (first use in this function)
ciol.c:619: error: 'F8_KEY' undeclared (first use in this function)
ciol.c:620: error: 'F9_KEY' undeclared (first use in this function)
actually, I have all the define in ciol.h
# if PLATFORM == PLT_LNX

#define UP 259
#define DOWN 258
#define LEFT 260
#define RIGHT 261
#define PGUP 339
#define PGDN 338
#define ENTER 10
I think I missed some steps before do the gcc -o as1 test.c
I didn't compile the ciol.c
How to compile all this under linux?
Thanks ahead.

Saturday, October 17, 2009

OOP344 assignment 1 IsTextEditor=1 left,right key problem

Assignment 1 Link
IsTextEditor=1,
leftkey and right key:
case LEFT_KEY:
if ((*offset)>4){
(*offset)-=4;
(*curpos)+=4;
}else{
(*curpos)+=(*offset);
(*offset)=0;
done=1;
}
break;
case RIGHT_KEY:
if(io_len(str)-*offset-fieldlen>4{
*offset = *offset +4;
*curpos=*curpos-4;
}else if(io_len(str)-*offset-fieldlen>0){
*offset=io_len(str)-fieldlen;
*curpos=*curpos-io_len(str)+*offset+fieldlen;
done=1;
}
break;
it can't pass test9.20
how the left key and right key works. for example, if I click left key, what's the *curpos and *offset should be? I'm confusing about this.
If I just put
case RIGHT_KEY:
case LEFT_KEY:
done=1;
break;
it can pass test9.20. But I think this is not the correct answer.
Anybody has some idea about this? I'm already two day behind the due day.
Thanks.