![]() |
Help with a file
I am working on this program that is a hex dump. I have to use a file. I have it where it ask the user what file it is and they enter like test.txt and it opens and uses file test but I want to change it so that it does not ask the user. How would I do that. Here is what I have.
:
|
Re: Help with a file
delete lines 5, 6 and 7 then set file_in_name to whatever you want
file_in_name = "test.txt"; |
Re: Help with a file
Now it is giving me an error.....c:\Documents and Settings\Owner\Desktop\program2\program2.cpp(32) : error C2440: '=' : cannot convert from 'const char [11]' to 'char [80]'
:
|
Re: Help with a file
This is what Ancient Dragon was telling you to do:
:
|
Re: Help with a file
thanks that helped
|
Re: Help with a file
In C and C++, you can't assign an array to another array: you have to individually copy each element of the array from one to another. As a C-style string (which is what you're using) is simply an array of characters, you can't do this:
:
file_in_name = "test.txt";:
strncpy(file_in_name, "test.txt", 79); |
| All times are GMT -5. The time now is 4:07 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC