So does anyone know how to write/read files in UWP C++? "Normal" file streams that worked for me before in console apps like fstream doesn't work, I've been googling that for hours and I learned that UWP has no access for anything. I found this: https://learn.microsoft.com/en-us/windows/uwp/files/quickstart-reading-and-writing-files but it's C# and everything else in the internet is C# aswell.. can't copy with that, I got stuck.
My program is a simple password manager, what I want to do is implement 2 functions:
read 3 TextBoxes, get stuff from it and put it one line then add the line to a file
read whole file full of passwords and put it in a TextBlock
Help please
Related
I'm opening a file for a video I'm creating and writing to disk with fopen in C++, I'm able to write to disk. But when I try to read it as I'm writing it, it will throw errors saying that it doesn't have permission to read the file as soon as I close the file or stop the program, I can suddenly read from it.
Not an issue with not finishing writing the write as if I crash the program, can still read it. Also, VLC's logs tell me it's a permission issue.
Any idea how to change that permission?
Response to William asking for code snippets or if open happened before the file existed:
Thanks William, here's what I've got. I waited a few minutes and could see the file with windows explorer by that point and waited until after I'd flushed and data was there, couldn't open with VLC or Notepad++ or Notepad or Windows Media Player
Notepad says cannot access because it is being used by another process, others too.
Here is the VLC log while it tries to open this:
http://snippi.com/s/g4cbu23
Here is where I create the file with fopen:
http://snippi.com/s/cyajw4h
At the very end is where I write to the file using fwrite and flush:
http://snippi.com/s/oz27m0g
You need to use _fsopen with _SH_DENYNO if you want the file to be shareable.
I learning how to use Python(2.7) GTK(2.0) and Glade(3.8) and at the moment i am trying to use the filechooserdialog to open a file and use it in my program, however i can not seem to find any information on where the opened file "goes". I have found many tutorials explaining how to use or make a file choosing dialog window but none explaning how to open the file in your program, for example i have a file with numbers that i want in a chart.
Does any of you kind gentlemen/women have a clue ?
I have a program that opens a WAV file and then plots the waveform. If the WAV file has 2 channels, two graphs are shown, one for each channel. It's working fine but I want to add things in the File Menu that I created. So far, I have three buttons: New, Open File, and Close. So far, the Open File and the Close buttons are working fine.
I want to make the program to be able to let the user view several waveforms of several WAV Files at the same time. One option would be to create more graphs, the process would be quite tedious. Another option would be to open another window and this is what I want to do.
However, this is my problem. I made a quick search on how to open an existing program in C++, and so far, the solutions that I encounter involve opening an exe file and the project folder does not contain an exe file.
I also tried to take a quick look on the functions and I can't find the function that seems to open the window and I can't seem to find it.
Your best bet is to use fork. Alternatively you could use threads.
Use GetModuleFileName API to get the path+ name of your executable. Then Use ShellExecute to run this APP.
I am not sure how to explain this, so I will give a scenario.
I want to write a program, which will be set as the default program for a file extension. When the program opens, it will output everything in the program. i.e file.txt contains the word hello, and when opened, my program opens and displays the word hello.
The idea is like Notepad. When a text file is opened, the contents are displayed. However, mine will be in a DOS window.
How can I achieve this?
Sorry if there is another question like this somewhere on here, TBH I am not too sure what this is called and thus can't search.
EDIT: My apologies. I am running Windows 7
If you open a file "with" your program (for instance using file type associations or by dragging the file onto the .exe), then the filename of the data file is passed as the command-line parameter to your application.
See:
What are the arguments to main() for?
I want to write a program, which will be set as the default program for a file extension.
See:
How File Associations Work
File Types and File Associations
You will associate your app with file extension and your app will do whatever it has to do.
I want to create an editor in C++ using SDL & OpenGL and have decided to use the win32 api to access the window bar menus (for file, edit and so on) and it seems quite simple, but I don't know how to create a "file-> open" file browser/loader... I'm hoping it's quite simple but I'm finding it hard to look up any tutorials on google because of the phrasing...
I just want to have an "open" or "import" option in the file menu that will open a standard windows file browser... then grab the file location, place it into a string then pass it into a function that is activated by selection a file... (I hope that makes sense).
The method I'm using to create the win32 menus are from this post:
http://www.gamedev.net/topic/400677-sdl-with-a-win32-menu/
Half way down the page there is a comment by "caseyd"... that's how I learnt how to use it, so that is my current understanding of win32 menus in SDL... I wanted to post the code here, but I didn't know how to paste it here in codeblocks without reformatting every line.
I'm hoping this is quite simple... Thanks to anyone who can teach me how or just point me in the right direction.
Oh, and I'm not trying to convert this to other operating systems, I just like SDL.
Use GetOpenFileName(). Note that that function blocks until the user selects a file, so if you want to continue rendering etc. in the background, make sure to run it on a separate thread.