Git Product home page Git Product logo

Comments (2)

thinkhy avatar thinkhy commented on July 30, 2024

++FILESYSCALL VAR6: [STARTED]
++FILESYSCALL VAR6: open mv.c
++FILESYSCALL VAR6: file handle 2
++FILESYSCALL VAR6: file handle 3
++FILESYSCALL VAR6: invoke read/write in a loop
#include "syscall.h"
#include "stdio.h"
#include "stdlib.h"

#define BUFSIZE 1024

char buf[BUFSIZE];

int main(int argc, char** argv)
{
int src, dst, amount;

if (argc!=3) {
printf("Usage: cp \n");
return 1;
}

src = open(argv[1]);
if (src==-1) {
printf("Open to open %s\n", argv[1]);
return 1;
}

creat(argv[2]);
dst = open(argv[2]);
if (dst==-1) {
printf("Unable to create %s\n", argv[2]);
return 1;
}

while ((amount = read(src, buf, BUFSIZE))>0) {
write(dst, buf, amount);
}

close(src);
close(dst);
unlink(argv[1]);

return 0;
}
++++FOIPLEENSFYISLCEA:L L[ SVTAARR6T:E DC]h
i+l+dO PpErNoFcIeLsEs: iodp eins t h e f i r s t f i l e t e s t 1 . i n
3
++++FOIPLEENSFYISLCEA:L Lo pVeAnR 6t:h eS UsCeCcEoSnSd
+f+iFlIeL EtSeYsStC2A.LiLn
Run the + + O P E N F I L E : o p e n t h e t h i r d f i l7et ht evsatr3i.aitni
ons
++++FOIPLEENSFYISLCEA:L L[ EVNADR]7
: [STARTED]

from cs162.

thinkhy avatar thinkhy commented on July 30, 2024

The problem didn't reoccur for a long time, so close this.

from cs162.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.