Message from C, C++ discussions

November 2019

— Sorry for my question, I want to open a file and write on with C++, but the file is in a folder protected by password, any ideas?

Message permanent page

— 

Well, I guess you should run the software that protected that folder in the first place. Otherwise, I don't think there's a way to do it

— One question

— Try googling

— If i have on a derived class a pointer should i create

— Destructor where i delete the pointer

— Assign pointer to null

— Your question seems unclear to me

— So i have a main class and a subclass , in each class i have 2 sifferent pointers , i create a destructor for main class , should i create a destructor for subclass ?

Message permanent page

— Where i delete the pointer from derived?

— Guys plz help me. I don't understand why my program crashes

— #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 50
int main()
{
struct personality
{
char surname[SIZE];
char name[SIZE];
int day;
int month;
int year;
int marks[5];
double average;

struct personality *next;
};

struct personality *PZ11;

FILE* fp = fopen("list.txt", "r");
int countStuds;
int symbol; int i = 0;
do {
fscanf(fp, "%s %s", &PZ11->surname, &PZ11->name);
fscanf(fp, "%d %d %d", &PZ11->day, &PZ11->month, &PZ11->year);
for (int j = 0; j < 5; j++)
fscanf(fp, "%i", &PZ11->marks[j]);
i++;
} while (!feof(fp));
fclose(fp);
countStuds = i;


for (int i = 0; i < countStuds; i++)
{
printf("|");
printf("%12s %10s \n", PZ11->surname, PZ11->name);
++i;
}

Message permanent page