Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 01-20-2006, 03:16 PM   #16
LQ Newbie
Registered: Jan 2006
Posts: 8

Original Poster
Rep: Reputation: 0

sorry about that thanks
Old 12-29-2006, 09:45 AM   #17
Registered: Dec 2006
Posts: 40

Rep: Reputation: 18
Do it in C

#include <stdio.h>
#include <string.h>
#include <malloc.h>

#define MAX_STRING_LENGTH 4096
#define MAX_LIST_SIZE 256

int main(int argc, char *argv[])
FILE *fidFile = NULL;
char strBuffer [MAX_STRING_LENGTH] = "";
char *strList[MAX_LIST_SIZE];
int intLast = 0;
int intCount = 0;

printf ("Test program with %s\n", argv[1]);

if ((fidFile = fopen (argv[1], "rt")))
while (!feof (fidFile) && fgets (strBuffer, MAX_STRING_LENGTH, fidFile))
printf (strBuffer);

strList[intLast++] = (char *)malloc (strlen (strBuffer));

for (; intCount < intLast; intCount++)
printf ("%s", strList[intCount]);

return 0;


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
How to replace a string in a text file jpan Linux - General 3 10-14-2012 06:17 PM
C++ text file line by line/each line to string/array Dimitris Programming 15 03-11-2008 08:22 AM
replace a string/number in a text file jpan Linux - General 3 10-22-2004 09:33 PM
How to pick a string from a text file? sdandeker Linux - General 1 02-12-2004 04:17 AM
Parsing a file for a string of text jamesmwlv Linux - General 2 12-02-2002 07:13 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:36 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
Open Source Consulting | Domain Registration