Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-30-2009, 02:24 AM   #1
LQ Newbie
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
Smile threads doesn't show words in text file

hey every body i'm new and i have questions.

in my os lab course we're working on two threads and the program was about to type numbers and words one thread for numbers and another for words and cuz it doesn't space for showing all of them in terminal we transfered it into a txt fill but in txt file only the numbers where shown and i want to khnow why?

please help me. thank you.
Old 04-30-2009, 08:48 AM   #2
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,899
Blog Entries: 27

Rep: Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186Reputation: 2186

Welcome to LQ!

Not enough information to aid you with your problem. Post a sample of the output data along with what you have attempted to complete the action on the data.

It does sound like homework to me. Read the LQ Rules!
Old 05-13-2009, 01:11 AM   #3
LQ Newbie
Registered: Apr 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Unhappy why threads didn't show words in *.txt files?????????????

i wrote this program:
#include <pthread.h>
#include <stdio.h>

struct char_print_parms

char character;

int count;

void* char_print (void* parameters)
struct char_print_parms* p = (struct char_print_parms*) parameters;
int i;
for (i = 0; i < p->count; ++i)
fputc (p->character, stderr);
return NULL;

int main ()
//int j;
//for (j = 0; j<200000;j++)
//printf (" %d ",j);
pthread_t thread1_id;
pthread_t thread2_id;
struct char_print_parms thread1_args;
struct char_print_parms thread2_args;

thread1_args.character = '1';
thread1_args.count = 30000;
pthread_create (&thread1_id, NULL, &char_print, &thread1_args);

thread2_args.character = 'a';
thread2_args.count = 20000;
pthread_create (&thread2_id, NULL, &char_print, &thread2_args);

pthread_join (thread1_id, NULL);

pthread_join (thread2_id, NULL);
return 0;
then in this program you will have print of number (1)
for 30000 times and word (a) for 20000 times but if you want to have them in text file the word (a) doesn't shown why???????????????????
help me please.


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
Editing a text file (switching around words) SentralOrigin Linux - General 2 07-17-2008 04:15 PM
Replacing words in a text file Raghavan_sat Programming 3 05-27-2008 04:11 PM
Shell script - how to show a specific line of a text file davi_cabral Linux - Software 3 09-28-2004 02:39 PM
How do I show the structur of directory with words? pelgrim Linux - Newbie 4 03-17-2003 07:30 PM
How can I catch some "KEY WORDS" from a text file without opening it? yuzuohong Linux - General 1 06-14-2002 10:27 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:52 PM.

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