Skip to content

Instantly share code, notes, and snippets.

@niklasfi
Created January 27, 2011 09:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save niklasfi/798283 to your computer and use it in GitHub Desktop.
Save niklasfi/798283 to your computer and use it in GitHub Desktop.
c++
#define _XOPEN_SOURCE 500
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(){
char* ds=new char[10];
for(unsigned int i = 0 ; i<10;i++)
ds[i]=65;
int fd = open("./f",O_WRONLY , 666);
int ssize = pwrite(fd, ds, 10,10);
}
var fs = require('fs')
var b = Buffer('AAAAAAAAAA');
fs.open('./f','w', '666' , function(err, fd){
fs.write(fd,b,0,10,10)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment