Mount sdcard using mount() function of linux

Multi tool use
up vote
0
down vote
favorite
I am trying to mount sdcard using mount function of linux with default options as follows
const char* src = "/dev/mmcblk1p1";
const char* trgt = "/media/user/sdcard";
const char* type = "fuseblk";
const unsigned long mntflags = 0;
const char* opts = NULL;
std::cout << "before mount" << std::endl;
// Mount the device
while(mount(src, trgt, type, mntflags, opts));
{
std::cout << "ERROR: " << strerror(errno) << std::endl;
usleep(2000000); // sleep for 2 sec
}
std::cout << "Device Mounted: " << dest_dir << std::endl;
But the program is stuck at line no. 9 while(mount(src, trgt, type, mntflags, opts)
. mount function dosent output anything even after long time and the program never enters the while loop. What is possibly going wrong? Is there any example implementation of mount() function that I can refer.
14.04 mount automount sd-card
New contributor
vacky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
I am trying to mount sdcard using mount function of linux with default options as follows
const char* src = "/dev/mmcblk1p1";
const char* trgt = "/media/user/sdcard";
const char* type = "fuseblk";
const unsigned long mntflags = 0;
const char* opts = NULL;
std::cout << "before mount" << std::endl;
// Mount the device
while(mount(src, trgt, type, mntflags, opts));
{
std::cout << "ERROR: " << strerror(errno) << std::endl;
usleep(2000000); // sleep for 2 sec
}
std::cout << "Device Mounted: " << dest_dir << std::endl;
But the program is stuck at line no. 9 while(mount(src, trgt, type, mntflags, opts)
. mount function dosent output anything even after long time and the program never enters the while loop. What is possibly going wrong? Is there any example implementation of mount() function that I can refer.
14.04 mount automount sd-card
New contributor
vacky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to mount sdcard using mount function of linux with default options as follows
const char* src = "/dev/mmcblk1p1";
const char* trgt = "/media/user/sdcard";
const char* type = "fuseblk";
const unsigned long mntflags = 0;
const char* opts = NULL;
std::cout << "before mount" << std::endl;
// Mount the device
while(mount(src, trgt, type, mntflags, opts));
{
std::cout << "ERROR: " << strerror(errno) << std::endl;
usleep(2000000); // sleep for 2 sec
}
std::cout << "Device Mounted: " << dest_dir << std::endl;
But the program is stuck at line no. 9 while(mount(src, trgt, type, mntflags, opts)
. mount function dosent output anything even after long time and the program never enters the while loop. What is possibly going wrong? Is there any example implementation of mount() function that I can refer.
14.04 mount automount sd-card
New contributor
vacky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I am trying to mount sdcard using mount function of linux with default options as follows
const char* src = "/dev/mmcblk1p1";
const char* trgt = "/media/user/sdcard";
const char* type = "fuseblk";
const unsigned long mntflags = 0;
const char* opts = NULL;
std::cout << "before mount" << std::endl;
// Mount the device
while(mount(src, trgt, type, mntflags, opts));
{
std::cout << "ERROR: " << strerror(errno) << std::endl;
usleep(2000000); // sleep for 2 sec
}
std::cout << "Device Mounted: " << dest_dir << std::endl;
But the program is stuck at line no. 9 while(mount(src, trgt, type, mntflags, opts)
. mount function dosent output anything even after long time and the program never enters the while loop. What is possibly going wrong? Is there any example implementation of mount() function that I can refer.
14.04 mount automount sd-card
14.04 mount automount sd-card
New contributor
vacky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
vacky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
vacky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Nov 28 at 18:55
vacky
1
1
New contributor
vacky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
vacky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
vacky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
vacky is a new contributor. Be nice, and check out our Code of Conduct.
vacky is a new contributor. Be nice, and check out our Code of Conduct.
vacky is a new contributor. Be nice, and check out our Code of Conduct.
vacky is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1096900%2fmount-sdcard-using-mount-function-of-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
RLdziPCiBiy,R 7OKMFjqqY rIs,Y,LWHwHG,wvvOI82IkLQN6g9kN,h,rHj7,RlPRg,hREPjUYEPPN