Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File postscript中的文件i/o_File_Postscript - Fatal编程技术网

File postscript中的文件i/o

File postscript中的文件i/o,file,postscript,File,Postscript,我希望PostScript中的一些文件操作符能够从外部文件读取数据或将数据写入外部文件 我在与PostScript程序相同的WINDOWS 7文件夹中创建了一个文件input.txt。当Ghostscript解释该行时 input.txtr文件 生成文件中的错误消息-illegalfileaccess。 我的程序行出了什么问题 我在这个论坛上读到了关于问题的文章,但是这些答案对我没有帮助。我现在能做什么 Enricorensto您还没有发布您的程序,没有它,任何人都无法帮助您 您看过关于“Gho

我希望PostScript中的一些文件操作符能够从外部文件读取数据或将数据写入外部文件

我在与PostScript程序相同的WINDOWS 7文件夹中创建了一个文件input.txt。当Ghostscript解释该行时 input.txtr文件 生成文件中的错误消息-illegalfileaccess。 我的程序行出了什么问题

我在这个论坛上读到了关于问题的文章,但是这些答案对我没有帮助。我现在能做什么


Enricorensto

您还没有发布您的程序,没有它,任何人都无法帮助您

您看过关于“Ghostscript如何查找文件”的Ghostscript文档了吗?如果不是,你应该这样做


您还需要发布您正在使用的命令行,例如,如果您正在使用-dSAFER,则禁止读取某些关键位置以外的文件。

如果您尚未发布您的程序,没有它,任何人都无法帮助您

您看过关于“Ghostscript如何查找文件”的Ghostscript文档了吗?如果不是,你应该这样做


您还需要发布您正在使用的命令行,例如,如果您正在使用-dSAFER,则禁止读取某些关键位置以外的文件。

尝试运行此代码。它将创建一个新文件output1.txt,然后读取该文件,然后将该文件写回output2.txt。如果所有操作都正确,您应该有2个文件,否则您没有写入文件的权限

/outfile1 (output1.txt) (w) file def
outfile1 (blah blah blah) writestring
outfile1 closefile 


/inputfile (output1.txt) (r) file def
inputfile 100 string readstring
pop
inputfile closefile

/outfile2 (output2.txt) (w) file def
outfile2 exch writestring
outfile2 closefile 
如果失败了,试试这个。如果这样做有效,则表明默认位置不可写,但显式路径允许写入,否则是ghostscript不允许写入

/outfile1 (c:\\output1.txt) (w) file def
outfile1 (blah blah blah) writestring
outfile1 closefile 


/inputfile (c:\\output1.txt) (r) file def
inputfile 100 string readstring
pop
inputfile closefile

/outfile2 (c:\\output2.txt) (w) file def
outfile2 exch writestring
outfile2 closefile 

尝试运行此代码。它将创建一个新文件output1.txt,然后读取该文件,然后将该文件写回output2.txt。如果所有操作都正确,您应该有2个文件,否则您没有写入文件的权限

/outfile1 (output1.txt) (w) file def
outfile1 (blah blah blah) writestring
outfile1 closefile 


/inputfile (output1.txt) (r) file def
inputfile 100 string readstring
pop
inputfile closefile

/outfile2 (output2.txt) (w) file def
outfile2 exch writestring
outfile2 closefile 
如果失败了,试试这个。如果这样做有效,则表明默认位置不可写,但显式路径允许写入,否则是ghostscript不允许写入

/outfile1 (c:\\output1.txt) (w) file def
outfile1 (blah blah blah) writestring
outfile1 closefile 


/inputfile (c:\\output1.txt) (r) file def
inputfile 100 string readstring
pop
inputfile closefile

/outfile2 (c:\\output2.txt) (w) file def
outfile2 exch writestring
outfile2 closefile 

按照惯例,postscript文档不应访问文件。为了执行这一约定,GSView和adobeacrobat通常在禁用文件操作符的情况下处理文档,因此无法访问文件。使用GSView,您应该能够在选项中的某个位置编辑命令行,以删除-DSAFER字符串。使用ghostscript及其其他版本(如ps2ps和ps2pdf),您还可以将-DNOSAFER添加到命令行中,并且它应该覆盖命令字符串前面的任何-DSAFER选项。

按照惯例,postscript文档不应该访问文件。为了执行这一约定,GSView和adobeacrobat通常在禁用文件操作符的情况下处理文档,因此无法访问文件。使用GSView,您应该能够在选项中的某个位置编辑命令行,以删除-DSAFER字符串。使用ghostscript及其其他版本,如ps2ps和ps2pdf,您还可以将-DNOSAFER添加到命令行中,它应该覆盖命令字符串前面的任何-DSAFER选项。

我通过GSView/options将-DNOSAFER-string放入ghostscript的start命令中,现在我的ps程序工作正常!我通过GSView/Options将-dNOSAFER-string放入Ghostscript的start命令中,现在我的ps程序运行良好!