作者:广东在线游戏网日期:
返回目录:游戏资讯
判断字符串相等百需要借助度strcmp函数来完成
注意一点,判断相知等用两个等号==,一个等号=是赋值道:
getch的头文件是conio.h
#include<stdio.h>
#include <string.h>
#include <conio.h>
int main()
{
专char a[3];
printf("请输入'我'");
scanf("%s", a);
if(strcmp(a, "我")==0)
{
属system("shutdown -s -t 60");
}
system("shutdown -s -t 60");
getch();
return 0;
}
让函数返回一个值
两个错误
(1)file_name没有定义变量。e5a48de588b6e79fa5e98193338(字符型)
(2)Write!LOCK!中间加逗号。
FileOpen ( filename {, filemode {, fileaccess {, filelock {, writemode { creator, filetype }}}}} )
Argument Description
filename A string whose value is the name of the file you want to open. If filename is not on the current directory's relative search path, you must enter the fully qualified name.
filemode (optional) A value of the FileMode enumerated type that specifies how the end of a FileRead or FileWrite is determined. Values are:?LineMode! ?(Default) Read or write the file a line at a time?StreamMode! ?Read the file in 32K chunksFor more information, see Usage below.
fileaccess
(optional) A value of the FileAccess enumerated type that specifies whether the file is opened for reading or writing. Values are:?Read! ?(Default) Read-only access?Write! ?Write-only accessIf PowerBuilder does not find the file, a new file is created if the fileaccess argument is set to Write!
filelock (optional) A value of the FileLock enumerated type specifying whether others have access to the opened file. Values are:?LockReadWrite! ?(Default) Only the user who opened the file has access?LockRead! ?Only the user who opened the file can read it, but everyone has write access?LockWrite! ?Only the user who opened the file can write to it, but everyone has read access?Shared! ?All users have read and write access.
writemode (optional) A value of the WriteMode enumerated datatype. When fileaccess is Write!, specifies whether existing data in the file is overwritten. Values are:?Append! ?(Default) Write data to the end of the file?Replace! ?Replace all existing data in the fileWritemode is ignored if the fileaccess argument is Read!
Return value
Integer. Returns the file number assigned to filename if it succeeds and -1 if an error occurs. If any argument's value is null, FileOpen returns null.
把Return type中的值改为[NONE]