home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
FLDPULLL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-28
|
1KB
|
57 lines
/*
fldpulll.c 5/11/88
% field_PullLeft
C-scape 3.2
Copyright (c) 1986, 1987, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
3/28/90 jmd ansi-fied
*/
#include "field.h"
char field_PullLeft(field_type f, int fpos)
/*
modifies: the field.
effects: deletes the character at fpos, pulls in the characters to the
left:
| helxlo mom|
^
| hello mom|
^
returns: the deleted character
*/
{
char del_char;
int recpos;
/* Remember the deleted character (assumes null chars exist
* past right end).
*/
del_char = f->record[fpos];
/* slide the record and merge */
for (recpos = fpos; recpos > 0; recpos--) {
f->record[recpos] = f->record[recpos-1];
if (f->merge != NULL) {
f->merge[f->r2m[recpos]] = (f->record[recpos-1] != '\0') ?
f->record[recpos-1] :
MRGPADCHAR;
}
}
/* put a blank at the start of the field */
f->record[0] = RECPADCHAR;
if (f->merge != NULL) {
f->merge[f->r2m[0]] = MRGPADCHAR;
}
return(del_char);
}