0

I'm trying to fill a string with the name of a file stored in a "fake memory" vector. Assuming I have a start pointer that directs me to the beginning of the string in my memory and I know the string completes with a NULL, how do I do this? My final goal is to access a file whose file name I have just stored in a string. Here is my general process flow:

- fill vector with data from a binary file.
- a pointer to the file name string contained in my vector is given to me
- starting at that pointer position in the array, get each character and store them in a string variable until I hit NULL
- use string variable to access file using fopen and then scanf

*I am implementing a very simple syscall emulation for a processor I designed in Verilog.

This is a bit above me at the moment so any help would be appreciated.
Thanks,
~DS

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Murtan
0

What part have you written and/or what specific question do you have?

- Did you get the binary file open?
- Did you fill the vector from the file?
- Did you find the start point of the string?
- Were you able to append characters to your string from the vector?
- Did you find the 'NULL' in the vector to know that you're done filling the string?
- Did you successfully call fopen?
- Did you successfully read the data with scanf?

We generally will not write your program for you, but will help when you show you're trying.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.