我有麻烦open()。它总是返回-1,我不知道代码出了什么问题。它一直在说:
Run Code Online (Sandbox Code Playgroud)r1: No such file or directory
但是txt文件与C程序位于同一目录中。
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#define BUFFSIZE 256
char upper(char c);
int main(void){
int fd1, read1, fd2, write2;
char *buffer[BUFFSIZE];
fd1 = open("minuscole.txt", O_RDONLY);
if (fd1 < 0) { perror("r1"); exit(1); }
read1 = read(fd1, buffer, BUFFSIZE);
close(fd1);
printf("%d", read1);
if(fd2 = open("maiuscole.txt", O_WRONLY | O_CREAT | O_TRUNC, 0644) > 0){
write2 = write(fd2, buffer, BUFFSIZE);
}
close(fd2);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我希望它创建一个名为:的文件,"maiuscole.txt" …
I've made a library and I've imported it adding a reference in the project and put using the namespace of my library, but when I'm trying to use a method it shows me an error.
"The type or namespace name 'UploadFiles' does not exist in the namespace 'MyGoogleUDS'(are you missing an assembly reference?)"
Project:
using MyGoogleUDS;
Run Code Online (Sandbox Code Playgroud)
error on this call:
MyGoogleUDS.UploadFiles("..\\" + asset.Name);
Run Code Online (Sandbox Code Playgroud)
My library:
namespace MyGoogleUDS
{
public class MyGoogleUDS
{
public static void UploadFiles(string path)
{
...
} …Run Code Online (Sandbox Code Playgroud)