PERROR打印参数无效

PERROR打印参数无效

本文介绍了FOPEN返回null - PERROR打印参数无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单的fopen操作似乎不起作用。 PERROR回报 - 参数无效。什么可能是错误的。

我有R中称为abc.dat一个ASCII文件:

  INT的main()
{
    FILE * F =的fopen(R:\\ abc.dat,R);
    如果(!F)
    {
        PERROR(出现以下错误);        返回1;
    }
}

输出:

解决方案

Escape your \. It must be \\ when used in the string.

FILE *f = fopen("R:\\abc.dat","r");

Otherwise, the string is seen by fopen to be including the \a "alert" escape sequence which is an invalid argument to it.

Common escape sequences and their purposes are:

\a  The speaker beeping
\\  The backslash character

\b  Backspace (move the cursor back, no erase)
\f  Form feed (eject printer page; ankh character on the screen)
\n  Newline, like pressing the Enter key
\r  Carriage return (moves the cursor to the beginning of the line)
\t  Tab
\v  Vertical tab (moves the cursor down a line)
\’  The apostrophe
\"  The double-quote character
\?  The question mark
\0  The "null" byte (backslash-zero)
\xnnn   A character value in hexadecimal (base 16)
\Xnnn   A character value in hexadecimal (base 16)

这篇关于FOPEN返回null - PERROR打印参数无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 15:58