#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "personscore.h"
int printBoard1 (int board[][20]);
int jarigumsa1(int putx, int puty,int board[][20]);
int dolgumsa11 (int board[][20]);
int dolgumsa13 (int board[][20]);
int overdol11 (int board[][20]);
int overdol12 (int board[][20]);
void game1(FILE *pf)
{
int x,y,a=0,i=0,breaknum=0;
int colorturn=0 ;
int board1[20][20] = {0,};
gscore score[2];
char line[40]={0,};
char line2[40] = {0,};
int scnt[2]={0,};
long offset=0;
for(i=0; i<2; i++)
{
scnt[i]=0;
fflush(stdin);
clear_eof(stdin);
printf("게이머의 이름을 입력하세요n");
fgets(line,40,stdin);
fseek(pf,0,0);
fread(&score[i], sizeof(gscore), 1, pf);
line2=score[i].name;
while(!feof(pf))
{
if(strcmp(line,line2)==0)
{
scnt[i]=1;
printf("저장되어 있는 이름입니다.n");
break;
}
fread(&score[i],sizeof(gscore), 1, pf);
///////////////////////////////////////////////////////////////////////////////////////////////////
#include<stdio.h>
#include<stdlib.h>
#define clear_eof(f) ((f->_flag) = ((f->_flag)^(f->_flag&_IOEOF)))
struct gamesonscore
{
char name[40];
int vomok;
int fomok;
int vpentagon;
int fpentagon;
};
typedef struct gamesonscore gscore;
형들 내가 오목게임을 만들었어
근데 여기서 파일에다가
사람이름 하고 승패를 적고 싶어서 헤더파일 하나 만들어서 구조체를 넣었거든
근데 strcmp 써서
게이머 이름 입력받은 line하고 파일에서 불러온 score[i].name을 비교했는데 비교가 안되는거야
그래서 다르게 해볼려고
line2 만들어서 score[i].name을 넣었는데
line2=score[i].name;에서
'식이 수정할 수 있는 lvalue여야 합니다' 라고 떠
형들 어떤거를 고쳐야 되는거야?
걍 string을 써바
char[] 쓰려면 line2=score[i].name가 아니라 strcpy,strncpy류 함수로 깊은복사 해줘야지