The fwrite function is not returning error, if the file was removed.
The fwrite function call is not returning error, when the file it writes to is removed, please advise on how to find if the file already opened and being written by a program is removed manually or by some other process.
please see the code below,
the above code was executed, I just left the file alone during the first two loops and then removed the file during the sleep and after that as well, the program is printing the success message, even though the file is not available.
I have two string returning function in ESQL/C
char *segment_name(lbuffer)
char *lbuffer;
{.....
and
char *get_bpdvalue(f_name)
char *f_name;
{......
both declared above main()
char *get_bpdvalue();
char *segment_name();
my problem is segment_name works on sprintf and strcpy... (5 Replies)
hi all,
my requirement is to create a thread by calling another function.
i.e i dont call pthread_create directly from main, but by calling another function (createThd - below ), from main.
Example:
void *thread_function(void *arg) { /* thread function */
int i;
rc =... (3 Replies)
Hi all,
I am very new to BASH shell programming. I need to return an integer from a function to the caller function. I did this:
but it keeps giving me wrong return:
Can someone help me out here, please?
Thanks (2 Replies)
hi
how can I return multiple values from a C function. I tried the following:
#include <stdio.h>
void foo(int id, char *first_name, char *last_name)
{
/*
this is just an example to illustrate my problem... real code makes
use of the "id" parameter.
*/
first_name = (char... (8 Replies)
Hi All
In my script, I can call on several functions. I have a logging function that is called by any of these functions. What I would like is some way of identifying which function I am using and pass this to the log function as some parameter.
Is there some built in command or way of... (3 Replies)
Hi,
my code is written in proC and it is in UNIX(AIX).I have written a small code for writing data into a binary file,but while writing my program is giving core dump.
Here Is my code----
fpWriteFile = fopen(WriteFileName,"wb+");
CHAR *recvgen;
recvgen = (char... (7 Replies)
I am working on the application in which I have to fetch values from the database and paste in url and send it to portal.
table=get_result("SELECT serialno,cas,Mode,FLC,TLC,location,CompName,CompCode,FG,FC,DispNo,TruckNo,LWbill,RRGPN,INVNO,DCN,RQTY,DQTY,SQTY,DDATE,RDATE,SDATE,TTIME FROM... (1 Reply)
Below is a flowchart of a program. Most everything works as expected, but there are a couple of issues that I need some expert help on. The check function was setup initially for a single user input. The input has been modified to allow for multiple inputs, so the code below does not work. My... (15 Replies)
I have some matlab code that sends the serial port elements of an array using matlab's fwrite function, e.g.:
fwrite(s, , 'uchar');
What would be a unix shell equivalent? E.g., after successfully accessing the port using instructions here:
Simple terminal serial port program for Linux/MacOSX... (3 Replies)
Discussion started by: darwin_886
3 Replies
LEARN ABOUT SUNOS
fwrite
fwrite(3C) Standard C Library Functions fwrite(3C)NAME
fwrite - binary output
SYNOPSIS
#include <stdio.h>
size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
DESCRIPTION
The fwrite() function writes, from the array pointed to by ptr, up to nitems elements whose size is specified by size, to the stream
pointed to by stream. For each object, size calls are made to the fputc(3C) function, taking the values (in order) from an array of
unsigned char exactly overlaying the object. The file-position indicator for the stream (if defined) is advanced by the number of bytes
successfully written. If an error occurs, the resulting value of the file-position indicator for the stream is unspecified.
The st_ctime and st_mtime fields of the file will be marked for update between the successful execution of fwrite() and the next successful
completion of a call to fflush(3C) or fclose(3C) on the same stream or a call to exit(2) or abort(3C).
RETURN VALUES
The fwrite() function returns the number of elements successfully written, which might be less than nitems if a write error is encountered.
If size or nitems is 0, fwrite() returns 0 and the state of the stream remains unchanged. Otherwise, if a write error occurs, the error
indicator for the stream is set and errno is set to indicate the error.
ERRORS
Refer to fputc(3C).
USAGE
Because of possible differences in element length and byte ordering, files written using fwrite() are application-dependent, and possibly
cannot be read using fread(3C) by a different application or by the same application on a different processor.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO write(2), fclose(3C), ferror(3C), fopen(3C), fread(3C), getc(3C), gets(3C), printf(3C), putc(3C), puts(3C), attributes(5), standards(5)SunOS 5.10 24 Jul 2002 fwrite(3C)