W

<< Click to Display Table of Contents >>

Navigation:  Concordance Programming Language Reference > Functions >

W

The following topic discusses the Concordance Programming Language (CPL) functions that begin with the letter W. For more information on CPL functions, see Functions, About the Advanced Programming Features, and About CPL Functions.

Weekday

text weekday(int d);

Description - Computes the day of the week for the parameter date and converts it to a text string. The parameter can be a date field or the result of the ctod() function.

Return Value - The name of the weekday.

See Also - day(), month(), year(), ctod(), dtoc()

 

Wordlen

int wordlen(int db; text field);

Description - Determines the length of the word in the character array, text variable, or database field. The length is determined by using the data base embedded punctuation.

Return Value - Length of the word, or 0 if the first letter of the word isn't alphanumeric.

 

Wrap

text wrap(text string; int width);

Description - Word-wraps the text within a column of width characters. The text can be a database field, character array, or text variable.

Return Value - The parameter text passed to wrap() is returned. wrap() does not return a duplicate of the text, but the actual text parameter fully wrapped.

oThe statement wrap(db->SUMMARY,20) is equivalent to db->SUMMARY = wrap(db->SUMMARY,20) except that the second statement provides additional processing work for Concordance without any effect whatsoever. wrap() returns the parameter text as opposed to a copyso that it can be passed as a parameter to other functions, such as show() or write(). Returning the original parameter also avoids insufficient memory errors when word-wrapping large text fields.

See Also - findline(), findnline(), findpline()

 

Write

int write(int handle; text buffer; int length);

Description - Writes length number of bytes to the file referenced by handle from the buffer. Handle must be a valid file handle returned by a call to open().

Return Value - The number of bytes written to file. If this value does not equal length, it indicates a disk full condition. A value of -1 indicates an error.

See Also - writeln(), read(), readln(), open(), close()

 

Writec

int writec(int handle; char ch);

Description - The character is written to the file referenced by handle. The handle must have been returned by the open() function.

Return Value - Returns a nonzero value if successful, and a -1 if an error is encountered.

See Also - readc(), open(), close()

 

WriteIn

int writeln(int handle; text buffer; int length);

Description - Writes the contents of the buffer to file and prints a carriage return-line feed after the text.

Return Value - Returns the number of characters written to file, or a -1 if an error was encountered. If the number of characters written is less than the length parameter, the disk is probably full.

See Also - write(), read(), readln(), open(), close

 

WritePrivateProfileString

int writePrivateProfileString( text szSection;

text szKey;

text szValue;

text szFile);

Description - The writePrivateProfileString() copies a string into the specified section of the specified initialization file.

Parameter

Function

szSection

The name of the section to which the string is copied. If the section does not exist, it is created. The name of the section is not case sensitive.

szKey

The name of the key to be associated string with a string. If the key does not exist in the specified section, it is created. If this parameter is NULL, the entire section, including all entries within the section, is deleted. Create a NULL value by declaring NULL as a text variable, but do not assign any value to it.

szValue

szValue is written to the file. If this parameter is NULL, the key pointed to by the szKey parameter is deleted.

szFile

The name of the initialization file. This must be the fully qualified name, with the .ini file extension.

Return Value - Nonzero if successful.

See Also - getPrivateProfileString()

Version - Version 7.0 and later.