If you only keep in a buffer the data, why not use printf for write directly
But I still don't understand some partes in the script, why do you use fields and campos variables? Is correct to print a line with less than 17 fields and another with exactly 17 fields in the same line?
When i run my C program which dynamically creates the output file, the program stops after sometime and gives the error "File size limit exceeded" even though my working directory has space.Can anyone plz help me out. (13 Replies)
Would appreciate some help, system was displaying an error regarding the kernal when a "sar" was run, after a reboot we get "WARNING user login limit exceeded by 1 user". We have plenty of licences. any ideas? (1 Reply)
Can you help. My server sunning solaris 9 on x86 platform pretty much hung for a few hours... I could not use telnet or ssh to the box - it kept refusing connection. A few hours later - I was able to log in again.
The server has not rebooted but here are the first errors in the messages log... (5 Replies)
Hello -
O/S is UnixWare 7.1.4
My prefered method of copying files between servers is 'rcp', which does not recognize symbolic links; therefore, files are duplicated many times over.
To avoid this duplication, I would like to use 'tar' and/or 'cpio' and pipe them through 'rcp', but... (1 Reply)
Hi,
How to write a script which checks the size of a log file?
I want that the log file contents to get cleared as soon as it increases 1 KB.
Thanks (3 Replies)
My code is
awk '{
out=split(FILENAME,a,"/")
sub(/\./,"_",a)
sub(/\-/,"_",a)
NEWSTRING="main_"a"_"a"(" # The word we want to insert
gsub(/main\(/,NEWSTRING); # the word to be replaced
print "Main becomes ",NEWSTRING")","in file ",FILENAME >> "/home/ds2/test/NEW2.txt" ... (4 Replies)
Hello Everyone,
I am new to this forum and also unix/linux. Our application today threw an alert whcih read as
"The users active count on host has crossed the threshold limit of 50
and is standing at 65."
This was although cleared when I restarted tomcat. But I am not sure why this count... (0 Replies)
We are having issues with our Postfix. The POP and IMAP services randomly stops working an sent e-mails return a "Command time limit exceeded".
We've found out that running these command fix the problem:
service cyrus-imapd stop
rm /var/lib/imap/tls_sessions.db*
rm... (2 Replies)
Hi,
Trying to join 2 files with awk (file1 has variable number of fields; file 2 has constant number of fields)
file1:
hook1|AA|BB|CC|DD
hook2|EE|FF
file2:
hook1|11|22
hook2|33|44
hook3|55|66
output:
hook1|11|22|AA|BB|CC|DD
hook2|33|44|EE|FF
hook3|55|66
What I tried so far:... (3 Replies)
Hello Friends,
I'm trying something hard (for me) to create a report script,normally the following script works:
Echos are just for cosmetic touch,
echo -n "\n-----\t----------\t-------------\t\t--------------\t\t--------\n
COUNT\tEVENT_TYPE\tRESPONSE_CODE\t\tINTERNAL_ERROR\t\tFLOWNAME... (7 Replies)
Discussion started by: EAGL€
7 Replies
LEARN ABOUT PHP
maxdb_fetch_field_direct
MAXDB_FETCH_FIELD_DIRECT(3) 1 MAXDB_FETCH_FIELD_DIRECT(3)maxdb_fetch_field_direct - Fetch meta-data for a single field
Procedural style
SYNOPSIS
mixed maxdb_fetch_field_direct (resource $result, int $fieldnr)
DESCRIPTION
Object oriented style
mixed maxdb_result::fetch_field_direct (int $fieldnr)
maxdb_fetch_field_direct(3) returns an resource which contains field definition information from specified resultset. The value of fieldnr
must be in the range from 0 to number of fields - 1.
RETURN VALUES
Returns an resource which contains field definition information or FALSE if no field information for specified fieldnr is available.
Object attributes
+-----------+---------------------------------------------------+
|Attribute | |
| | |
| | Description |
| | |
+-----------+---------------------------------------------------+
| name | |
| | |
| | The name of the column |
| | |
|max_length | |
| | |
| | The maximum width of the field for the result |
| | set. |
| | |
| type | |
| | |
| | The data type used for this field |
| | |
| decimals | |
| | |
| | The number of decimals used (for integer fields) |
| | |
+-----------+---------------------------------------------------+
EXAMPLES
Example #1
Object oriented style
<?php
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
$query = "SELECT name, cno from hotel.customer ORDER BY name";
if ($result = $maxdb->query($query)) {
/* Get field information for column 'SurfaceArea' */
$finfo = $result->fetch_field_direct(1);
printf("Name: %s
", $finfo->name);
printf("Table: %s
", $finfo->table);
printf("max. Len: %d
", $finfo->max_length);
printf("Flags: %d
", $finfo->flags);
printf("Type: %d
", $finfo->type);
$result->close();
}
/* close connection */
$maxdb->close();
?>
Example #2
Procedural style
<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
$query = "SELECT name, cno from hotel.customer ORDER BY name";
if ($result = maxdb_query($link, $query)) {
/* Get field information for column 'cno' */
$finfo = maxdb_fetch_field_direct($result, 1);
printf("Name: %s
", $finfo->name);
printf("Table: %s
", $finfo->table);
printf("max. Len: %d
", $finfo->max_length);
printf("Flags: %d
", $finfo->flags);
printf("Type: %d
", $finfo->type);
maxdb_free_result($result);
}
/* close connection */
maxdb_close($link);
?>
The above example will output something similar to:
Name: CNO
Table:
max. Len: 4
Flags: -1
Type: 0
SEE ALSO maxdb_num_fields(3), maxdb_fetch_field(3), maxdb_fetch_fields(3).
PHP Documentation Group MAXDB_FETCH_FIELD_DIRECT(3)