What would the declaration for the charcter array look like if I want to copy the string(s) into that I find? I will need a char array that can handle up to 20 occurances of a string in a file. Each...
Type: Posts; User: flightsimdude
What would the declaration for the charcter array look like if I want to copy the string(s) into that I find? I will need a char array that can handle up to 20 occurances of a string in a file. Each...
hammer thanks...I'm almost at wits end...I will look at what you have (i.e., fgets, etc) and try to incorporate it into code to search through a file to look for the string I need. I know I've said...
How can I search a file for a string and then copy it to a string variable?
Dave, you're right I apologize. I did previously post code although I have changed it quite a bit. The only question I really need answered is:
When I locate the string I want to copy, how do I copy...
I guess I was tired when I originally wrote this. What I really need to do is be able to do the following:
1. Search for multiple occurances of a string.
2. Each string that I ultimately want to...
thanks guys. It's late for me now. Ill be back tomorrow after I try what you have conveyed to me. Thanks again!
ok I'm completely humbled...not that I needed any! How do I advance the pointer...or is there another simpler way to read through the file and ignore the blank lines and lines that are comment only...
twm...you kind of blew me away with the stripping of the white space..my previous reply was to hammer's I didn't see yours until after I replied. Any advice on my previous reply...either twm or...
good advice. All comment lines are of the syntax "//". Would I be wise to choose the function 'getc' to search for a new line '\n' followed by the '/' and then another '/'? or is there a better way...
funny...and thx hammer
I would want to exclude those lines which are blank and those that are entirely a comment line. Just not sure how to do this.
Question: How can I only count the lines of code in a source file and ignore the comment lines and blank lines?
For example, if I have a source file as follows how would I only count the lines as...
What is the preferred method to search for a string and then copy only part of the string? For instance. I want to search for a string called:
"@foobar@"
I only want to copy the "foobar" part.
...
How can a filename be passed as a parameter from one function to another function? For instance I have a filname as a string defined as:
char[] = "filename.txt" ;
What would the format of the...
thanks a bunch for your input...I should have been more patient with myself and just figured it out (like I did) before I posted. I'm still glad I asked the questions though. You showed me...
I'm being a bonehead...I got this part working...thanks for your input. My problem was not using the correct type for 'b1'. I fixed that and it's ok. I have a new problem where I first use the...
got in or not. please see last post for code and data set.
Thanks!
Flight
The data file looks like this:
132.34
100
235
7859.03
444.31
332
298
545.77
676
using sscanf. The data file is only a sinle column of 10 integers and floats. Let me know if you think sscanf will work.
Thanks!
flight
I need to read integers and floating point data from a file and calculate the mean and variance. I know how to perform the calculations, however I don't know where to start when it comes to reading...
Thanks again!
flight
would you consider this an unelegant method? Don't get me wrong I sincerely do appreciate your reply!
the code works well except it will not count the last word in the file. I noticed the last word doesn't have a line feed at the end. How can I fix this?
Thanks!
flight
include <stdio.h>
thanks dave..I looked at it tried what was suggested and still got the wrong answer...zero words counted s/b 7 words.
attached is the source code file.