Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'm making a files hash calculator app for a kde linux enviroment
but i'm facing a few problems:

in this code that calculate the file's hash
hashwrapper *sha512 = new sha512wrapper();
std::string sha512Hashing = sha512->getHashFromFile("file01.iso");

you notice the file01.iso here
my question is:
1. how to place an interpolation file here instead of a predefined file?
i mean i don't know the name of the file that the user will choose in advanced
so how i do an interpolating move like in Ruby we do
userInput=gets
#{userInput}

how do i do so in Qt Creator

2. i have a lineEdit box that i made only to display the name of the file
that the user will choose after closing QFileDialog
how display the file name in the lineEdit box ?


i'm so grateful to whoever whom will answer my questions

What I have tried:

 QFile filename01;
hashwrapper *sha512 = new sha512wrapper();
std::string sha512Hashing = sha512->getHashFromFile(filename01);

and a lot of similar moves but no luck
Posted
Updated 31-Oct-16 23:03pm
Comments
[no name] 24-Sep-16 7:29am    
"filename01" is nothing so I don't see how you think that would work. You should work through some tutorials on C++.

You would most likely use a dialog. Either a predefined OpenFileDialog or QDialog Class | Qt 4.8[^].
 
Share this answer
 
i have found the solusion

C++
QString open_file = QFileDialog::getOpenFileName(this,"open file","/home path");
QFile file01(open_file);


now if you want to use the file for any operation you like
for example (get the file name or size) just use (file01)
to do operations on


by the way there's 2 types of files on QFileDialog
1. Static File....example ("/home/user/documents/file01.iso")
2. Dynamic File...example (the file that the user WILL pick from Open Dialog)

i hope this will be clear to the beginners like myself
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900