Click here to Skip to main content
16,019,018 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: fclose(f_ptr2) - "Access Violation or memery can not be read" Pin
David Crow27-Nov-07 3:46
David Crow27-Nov-07 3:46 
GeneralRe: fclose(f_ptr2) - "Access Violation or memery can not be read" Pin
Sunil Shindekar27-Nov-07 21:06
Sunil Shindekar27-Nov-07 21:06 
QuestionRe: fclose(f_ptr2) - "Access Violation or memery can not be read" Pin
David Crow28-Nov-07 2:32
David Crow28-Nov-07 2:32 
Questionfclose(f_ptr2) - "Access Violation or memery can not be read" Pin
mrby12326-Nov-07 5:59
mrby12326-Nov-07 5:59 
AnswerRe: fclose(f_ptr2) - "Access Violation or memery can not be read" Pin
Mark Salsbery26-Nov-07 6:05
Mark Salsbery26-Nov-07 6:05 
GeneralRe: fclose(f_ptr2) - "Access Violation or memery can not be read" Pin
mrby12326-Nov-07 6:36
mrby12326-Nov-07 6:36 
QuestionRe: fclose(f_ptr2) - "Access Violation or memery can not be read" Pin
David Crow26-Nov-07 7:12
David Crow26-Nov-07 7:12 
AnswerRe: fclose(f_ptr2) - "Access Violation or memery can not be read" Pin
mrby12326-Nov-07 7:30
mrby12326-Nov-07 7:30 
They are:

const int MAX=15;
float north[2000];
float east[2000];
float elv[2000];
CString fname[2000];
char buffer[MAX];

buffer is used to read data as dumy. The data never exceeds 15 characters. Thanks

In fact, the following code works fine and print all files of *.txt without an error message.

----------------------------------------------------
void CBlast_vib_procDlg::Next()
{
FILE *f_ptr1;
FILE *f_ptr2;
const int MAX=16;

CBlast_vib_procDlg rr;
//
float north[2000];
float east[2000];
float elv[2000];
CString fname[2000];
//
char buffer[MAX];

// TODO: Add your control notification handler code here

UpdateData();

if(m_outputFileName == "" )
{

MessageBox("All file names have to be typed in !");
rr.m_outputFileName = m_outputFileName;
rr.DoModal();
UpdateData(false);

}
#define BUFSIZE MAX_PATH
WIN32_FIND_DATA FindFileData;
LPTSTR DirSpec;
//
HANDLE hFind = INVALID_HANDLE_VALUE;
CString fileName[2000];
int i=0;
DirSpec = (LPTSTR) malloc (BUFSIZE);
DirSpec=TEXT("*.txt");
//
hFind = FindFirstFile(DirSpec, &FindFileData);
fileName[0]=FindFileData.cFileName;
//
while (FindNextFile(hFind, &FindFileData) != 0)
{
i+=1;
fileName[i]=FindFileData.cFileName;
}
int nfile=i;
FindClose(hFind);

// open output data file

if((f_ptr1 = fopen(m_outputFileName,"w")) == NULL) {

MessageBox("output file open problems !");
rr.m_outputFileName = m_outputFileName;
rr.DoModal();
UpdateData(false);
}
//
fprintf (f_ptr1, "%i\n", nfile);
for (int ii=0;ii
QuestionLooking for a Gantt chart control Pin
Interrobang26-Nov-07 4:44
Interrobang26-Nov-07 4:44 
Questioncompile error when make a wchar_t conversion Pin
George_George26-Nov-07 3:53
George_George26-Nov-07 3:53 
AnswerRe: compile error when make a wchar_t conversion Pin
CPallini26-Nov-07 4:04
mveCPallini26-Nov-07 4:04 
GeneralRe: compile error when make a wchar_t conversion Pin
George_George26-Nov-07 20:46
George_George26-Nov-07 20:46 
GeneralNope Pin
CPallini26-Nov-07 22:23
mveCPallini26-Nov-07 22:23 
GeneralRe: Nope Pin
George_George26-Nov-07 23:31
George_George26-Nov-07 23:31 
GeneralRe: Nope Pin
CPallini26-Nov-07 23:50
mveCPallini26-Nov-07 23:50 
GeneralRe: Nope Pin
George_George27-Nov-07 3:44
George_George27-Nov-07 3:44 
GeneralOfftopic Pin
Nelek27-Nov-07 21:12
protectorNelek27-Nov-07 21:12 
QuestionVista problem with HtmlView Pin
john563226-Nov-07 2:41
john563226-Nov-07 2:41 
Question_snprintf_s in Windows Embedded XP Pin
janadhana26-Nov-07 2:13
janadhana26-Nov-07 2:13 
AnswerRe: _snprintf_s in Windows Embedded XP Pin
JudyL_MD26-Nov-07 2:35
JudyL_MD26-Nov-07 2:35 
QuestionVC++ Codec (h264) Pin
renoreballos26-Nov-07 2:02
renoreballos26-Nov-07 2:02 
AnswerRe: VC++ Codec (h264) Pin
Mark Salsbery26-Nov-07 6:02
Mark Salsbery26-Nov-07 6:02 
GeneralRe: VC++ Codec (h264) Pin
renoreballos26-Nov-07 16:42
renoreballos26-Nov-07 16:42 
GeneralRe: VC++ Codec (h264) Pin
Mark Salsbery27-Nov-07 7:21
Mark Salsbery27-Nov-07 7:21 
GeneralRe: VC++ Codec (h264) Pin
renoreballos27-Nov-07 14:40
renoreballos27-Nov-07 14:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.