Skip to contentSkip to conversation

Write to file

DISCUSSION Anant Malewar 3 participants 5 messages Aug 7, 2006 – Aug 10, 2006

lore
Share & tools
lore
#0 lore raw

Hi,
I have an OSK 5912 rev C board. I am able to boot it and mount the
filesystem over NFS. My application needs to write some data in a file. But the filesystem is read only (/ is mounted as read only). What do I need to do to make my application write to a file so that I will be able to read this file it on my host PC?

Regards,
Anant

-------------------------------------------------------------------------------------------------------------------------------
DISCLAIMER:
This message (Including any attachments) is confidential and is intended only for the addressee. All MoTech Software mails and attachments are scanned for all known viruses at the time of transmission. However, please scan the mail and attachments for viruses before opening or downloading from this transmission. We will not accept any liability for damages through virus. If you are not the intended recipient or received this message by mistake, please notify the sender by E-mail & delete the message from the system. Any unauthorized use or dissemination of the message in whole or part is strictly prohibited.

#1 lore raw

Hi, Anant!

Why your application can't write the same directory where it is located? You run application from NFS, right?
If you really need to remount root file system to RW, you can use the following command
mount -n -o remount /

Sergey.

#2 lore raw

Hi all,

I have the same problem. I have a application write by C language, and i have to read and write files on system. But now I cross compiler it to run on OMAP5912, but it doesn't work anymore.

Can somebody tell me, that what can I do to read and write the files on the OMAP system, either I use the NFS or use the JFFS filesystems.

Very Thanks and have a nice day

Nguyen

P/S: sorry about my English.

-----Ursprüngliche Nachricht-----
Von: linux-omap-open-source-bounces+duongthanh.nguyen=de.bosch.com@linux.omap.com [mailto:linux-omap-open-source-bounces+duongthanh.nguyen=de.bosch.com@linux.omap.com] Im Auftrag von Sergey Vointsev
Gesendet: Montag, 7. August 2006 14:58
An: [email protected]
Betreff: Re: Write to file

Hi, Anant!

Why your application can't write the same directory where it is located? You run application from NFS, right?
If you really need to remount root file system to RW, you can use the following command
mount -n -o remount /

Sergey.
_______________________________________________
Linux-omap-open-source mailing list
[email protected]
http://linux.omap.com/mailman/listinfo/linux-omap-open-source

#3 lore raw

Hi, Nguyen!

As I understand, there aren't some special commands for read/write files on OMAP. At least the following simple program worked fine on both my desktop and my OSK5912:

********************
#include <stdio.h>
int main()

{
	FILE *f;
	f = fopen ("/tmp/testfile","a+");
	fprintf (f,"Hello! \n");
	fclose (f);
	return 0;
}

********************

I have rootfs mounted via NFS, but I believe it doesn't really matter. So you should check the following things:
1. is your filesystem mounted in rw mode or only for reading
2. does you program have permissons (chmod/chown I mean) for writing to the directory you use

Sergey.

#4 lore raw

Thanks alot Sergey,

The problem is solved. I can read and write perfectly now on NFS.

Regard,
Nguyen

-----Ursprüngliche Nachricht-----
Von: linux-omap-open-source-bounces+duongthanh.nguyen=de.bosch.com@linux.omap.com [mailto:linux-omap-open-source-bounces+duongthanh.nguyen=de.bosch.com@linux.omap.com] Im Auftrag von Sergey Vointsev
Gesendet: Dienstag, 8. August 2006 10:26
An: [email protected]
Betreff: Re: Write to file

Hi, Nguyen!

As I understand, there aren't some special commands for read/write files on OMAP. At least the following simple program worked fine on both my desktop and my OSK5912:

********************
#include <stdio.h>
int main()

{
	FILE *f;
	f = fopen ("/tmp/testfile","a+");
	fprintf (f,"Hello! \n");
	fclose (f);
	return 0;
}

********************

I have rootfs mounted via NFS, but I believe it doesn't really matter. So you should check the following things:
1. is your filesystem mounted in rw mode or only for reading
2. does you program have permissons (chmod/chown I mean) for writing to the directory you use

Sergey.
_______________________________________________
Linux-omap-open-source mailing list
[email protected]
http://linux.omap.com/mailman/listinfo/linux-omap-open-source