Questions tagged [cfile]

The cfile tag should be used for questions about the CFile and CStdioFile classes (and their relatives) in MFC (Microsoft Foundation Classes) for C++ code. You should normally add the C++ (or possibly Visual-C++) and MFC tags too. It is not appropriate for questions tagged C — use the plain 'file' as the tag for such questions.

See CFile class and CStdioFile class on the Microsoft Documentation site for two primary references.

47 questions
0
votes
1 answer

CFile writes some garbage value

Im wriitng some data in File.But it doesnot write this properly. Code: CString sFileName = "C:\\Test.txt"; CFile gpFile; CString testarr[10] = {"Tom","Ger","FER","DER","SIL","REM","FWE","DWR","SFE","RPOP"}; if (!gpFile.Open(…
Anu
  • 905
  • 4
  • 23
  • 54
0
votes
0 answers

permission denied to run a temporary c file in msys2

permission denied to run a temporary c file in msys2 it says "Cannot create temporary file in /tmp/: Permission denied Aborted (core dumped)" i tried to run a c file. but the permission is denied.
0
votes
0 answers

Line break is not working while writing csv file with CFile Visual Studio

here is my code: //.. CString strWrite; // "VLF,3,30,100.000000,10.000000" strWrite.Format(_T("%s,%d,%d,%f,%f\n"), str_aName[i], anFreq[i],anFreq[i+1], afWvLen[i], afWvLen[i+1]); int n = strWrite.GetLength(); //…
Zrn-dev
  • 99
  • 5
0
votes
0 answers

Cfile idempotentRepository Bean using a registered bean

when using a cFile start point, the use of Spring beans declared at design time work fine for declaring the Fileidempotent repository that I wish to create. But I want to have the bean configured at Runtime or at design time but soft-coded with…
0
votes
0 answers

fwrite( ) function writing input as it is not in BINARY?

I just created a simple program to write to a binary file in C. But the .dat or .bin file when opened through notepad or any editor it is showing the input as it was given without converting it(converting in sense is the special symbols which I have…
paceHut
  • 1
  • 1
  • 1
0
votes
0 answers

Can Win32 file handles linger after being closed with CloseHandle?

I'm trying to debug what looks like deadlock issue, happening on one remote machine. I did not manage to create a reproducible case for on my local machine, and neither does it happen 100% of the time on the remote one. My main question is : can a…
F.X.
  • 6,809
  • 3
  • 49
  • 71
0
votes
1 answer

how to load a c string from a file

my code keeps throwing a segmentation fault from internal c libraries, my code is the following: char *vertexShaderCode = (char *)calloc(1024, sizeof(char)); FILE *shaderFile; shaderFile = fopen("./shaders/vertex.glsl",…
0
votes
1 answer

How to convert CTime to integer?

I need to get modify date from a file. CFileStatus stat; CFile::GetStatus(strFilePath, stat); It returns 1585557924 to be CTime. (it look like a timestamp) stat.m_mtime I have a lot of file and I need to get modify date from each file…
FRAME_TH
  • 29
  • 7
0
votes
1 answer

Problem with scanf/gets in C file handling

Whenever I run this code, final scanf function to get 'email' input does not execute and I get 'Updated successfully!' message directly! I tried using gets() instead of scanf and I'm getting the same problem. Can someone please explain the problem…
Jayanth
  • 41
  • 3
0
votes
2 answers

linking files in c( multiple definition of...)

Im trying to link a few files in c and im getting this erorr: "multiple definition of createStudentList" my main.c: #include "students.h" int main(void) { return 0; } students.h: #ifndef _students_h_ #define _students_h_ #include…
zoids3
  • 65
  • 10
0
votes
1 answer

Checking line breaks (newline characters) with CFile

I need to check whether a file is ended with a line break or not, using CFile. What I have tried: point the file pointer at the end of the file move the pointer back by 2 units check if the pointer is pointing at \r\n Here is my…
user3545752
  • 351
  • 1
  • 7
  • 15
0
votes
1 answer

C++ CFile sharing with C# App not working?

I'm having trouble getting a file created and populated with a c++ application to be read by a different c# application while it's still open in the c++ application. I create the file with the line: txtFile.Open(m_FileName, CFile::modeCreate |…
TheEvilMetal
  • 323
  • 2
  • 14
0
votes
2 answers

CFile returns debug assertion

I have an old project in Visual C++ and I'm trying to migrate it to Visual Studio 2013. When I verify if a txt file exists, CFile returns debug assertion error. The code is: if (!txt_file.Open(txt_name, CFile::modeWrite | CFile::shareDenyWrite …
Madalin
  • 129
  • 15
0
votes
1 answer

CStdioFile::GetPosition on long file (15 MB) is wrong by few bytes

I have following code where the idea is to read a text file line by line and save the current position m_numBytesRead. So if I break the loop (on my case to split text parsing by chunks on big files) and I try to access a second time by making a…
0
votes
1 answer

How can I dynamically allocate a CFile type of variable? (C++, CFile, new)

static TCHAR BASED_CODE szFilter[] = _T("YUV Files|*.yuv|") CFileDialog fileDlg(TRUE, _T("yuv"), _T("bus.yuv"), OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, szFilter); if (fileDlg.DoModal() == IDOK) { CString pathName = fileDlg.GetPathName(); …
Danny_Kim
  • 299
  • 2
  • 18