Does fopen call CreateFile on Windows? - file-io

From what I know CreateFile is found in kernel32.dll, and fopen is found in libc. Assuming for this question they are both being used for file operations, does fopen call CreateFile on Windows or is it its own standalone file io function with its own code?

fopen() calls CreateFile().
I debugged into fopen before and ended up in CreateFile. Unless something changed (which I doubt).. it would still be that way.
I also found this on osr:
https://community.osr.com/discussion/119538

Related

Where can I find a Raku core dump file?

I ran /home/foo/bar.p6 from /path/to/data and it says "Segmentation fault (core dumped)"
I cannot find the core dump file in /var/crash or my home directory or current working directory.
I think it is Raku itself that core-dumped.
Where would raku put the core dump file if my program caused the dump, and where would I find the dump file if Raku itself core-dumped?
Thanks.
/var/crash is for system crash dumps. Core dumps are usually saved under /var/lib/systemd/coredump/, if not, then it might help to also tell us your distribution and whether your system uses systemd. Also check /etc/systemd/coredump.conf for custom settings.

How can I edit header in dll file?

I have exe file and, that uses my own .dll library. When I launch exe file I get the error
The procedure entry point for SomeFunction could not be located in the
dynamic link library mylib.dll.
How can I fix this problem ? Is this possible to change the header in .dll using CFF Explorer or Windbg ?

unable to open text file

I'm trying to get a program to open a file and read from it. However, I can't seem to get it to open the file. I've read several threads about this and I've seen the suggestion to make sure the file is in the same directory as my executable. I don't know how to check if that's true. The text file is saved in the same file as my program files, if that helps. Can anyone give me some input? Relevant code below. Thanks!
std::ifstream myfile;
myfile.open("../ResInput.txt", ios::in);
if(myfile.is_open()){
getline(myfile, stemp1);...
Your open() call is trying to go up one directory to read the file as it's written right now. If you want the file opened in the same directory as your executable, remove the ../ in your open() call.
This is also assuming your OS accepts a forward slash as a directory separator. It would also be useful to know the error you are getting.

Lua, io.input() can't find file

I have myfile.txt sitting in the same directory as my lua file, yet when I call io.input("myfile.txt") I get the error bad argument #1 to 'input' (myfile.txt: No such file or directory).
I don't see how this can be going wrong, have I misunderstood Lua's I/O?
You need to fully qualify the path (eg. "/home/username/myfile.txt" on *NIX, "C:\directory\myfile.txt" on Windows). When you don't, the Lua interpreter expects the file to be in the same directory as the interpreter.
Read this question for an easy fix using arg[0] to get the current directory of the script being executed.

Read .inf file in nsis script

How to read a .inf file in nsis script? To be precice: I wanna read ${PRODUCT_VERSION} from a .inf file which is suppose like this: Version = 1.0.0, so I have to read it in .onInit function. Tried using FileRead or ConfigRead but failed to get what is required. I have to read a .inf file only cant change it to .txt or .config or any other. Please help...
ReadINIStr should work