Re: write



Here's my new code that seems to work great.

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>

int main() {
int file;
if((file=creat("fil",S_IRUSR))==-1) {
fprintf(stderr,"error\n");
return -1;
}
char buf[]="string\n";
ssize_t t;
if((t=write(file,buf,200))==-1) {
fprintf(stderr,"write error\n");
return -1;
}
int a;
if((a=close(file))==-1) {
fprintf(stderr,"close error\n");
return -1;
}
return 0;
}

And when I opened this file with a text editor the word "string" was
nicely printed. The only thing is file reports it as a data file and not a
text file.

Bill


.



Relevant Pages

  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... conformant string. ... int repeats, reps; ... ref satisfierLength); ...
    (comp.programming)
  • RE: Controling Modal Dialogs (Solution)
    ... doesn't return until the 'modal' browser returns. ... string varOptions) ... public void DocumentComplete ... int rc = winDisp.Invoke(rgDispId, ref guid, 0, ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Gcc compatible header file
    ... A string collection is a table of zero terminated strings that will grow ... typedef struct _StringCollection StringCollection; ... int; ... bool; ...
    (comp.lang.c)
  • Kernighan and Pikes "Beautiful" Code
    ... conformant string. ... int repeats, reps; ... ref satisfierLength); ...
    (comp.programming)
  • Re: FTP CD command
    ... public const int GENERIC_WRITE = 0x40000000; ... string lpszProxyName, ... public static extern IntPtr InternetConnect ( ... public static extern bool FtpGetCurrentDirectory ( ...
    (microsoft.public.dotnet.languages.vb)