LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-03-2005, 08:31 AM   #1
AbhishekSamuel
LQ Newbie
 
Registered: Apr 2005
Location: India
Posts: 22

Rep: Reputation: 15
C File reading and writing


hi

I was writing an application where i need to write text to a file whose size is determined at runtime.

I am familiar with this

struct book
{
int num;
char msg[FIXED_SIZE];
};

Then performing fread and fwrite.
But what i require is char *msg rather than msg[FIXED_SIZE].

Could anyone give me some reference or a snippet of how to do this.

Thank You
Abhishek Samuel
 
Old 05-03-2005, 08:40 AM   #2
pycoucou
Member
 
Registered: Apr 2004
Location: Edinburgh
Posts: 78

Rep: Reputation: 15
I don't get exactly your point

your two variables message are equivalent: msg[0]=*msg

Sorry for this poor help, but I'm not fully acquainted with de details of fwrite but I guess that typecasting would be sufficient.

PY
 
Old 05-03-2005, 11:58 AM   #3
Dave Kelly
Member
 
Registered: Aug 2004
Location: Todd Mission Texas
Distribution: Linspire
Posts: 213

Rep: Reputation: 31
Question: Class assignment.
Library Card Program?
 
Old 05-03-2005, 04:59 PM   #4
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Rep: Reputation: 31
malloc()
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH script Ė reading and writing variables to a separate file morrolan Programming 10 09-20-2005 08:45 AM
vb.net reading and writing to a text file simultaneously mrobertson Programming 3 09-08-2005 01:30 PM
Help reading and writing to file xiste Programming 1 04-15-2005 01:43 AM
Reading and Writing DVD media elsabio Fedora 2 03-06-2005 07:25 PM
reading / writing OpenOffice files. G™utama Programming 1 11-04-2003 07:46 AM


All times are GMT -5. The time now is 05:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration