Alright thank you for the advice. I will go fix that.
Type: Posts; User: InicDominus
Alright thank you for the advice. I will go fix that.
Salem, it gathers a whole line of data from a file after finding a keyword. I know it may be sloppy as I have never used C before but it works fine.
From the example code, it would be on line 3 after I have made the prototype. The error is "invalid storage class for function 'getAndPrint' ". If I dont declare the protoype static I get errors:...
Hey again,
So this time I am trying to make a function to call twice instead of repeating the chunk of code twice. When I was not using the function the code worked fine so it seems like I set up...
Thank you that worked great!
Hey guys,
I am trying to throw in a couple integer values to a char[].
In the array I have the date broken down with the struct tm variables into year month and day. Here is what I have.
...
Just used stdout to test and was able to get everything working fine. thanks again for all your help!
the data i am searching for will look something like this:
TARGET
1 4237568 -24001356 e236484865 1235.438975
2 65.34576 4798722 u394623 .234568 23468769
there is always a main name (TARGET)...
FILE* output_file;
output_file = fopen("pathToFile", "w");
FILE* file;
file = fopen("pathToFile", "r");
char line[256];
char term[12] = "TARGET";
char data1[256];
char data2[256];
Very slick!
I tried that but I must be missing something /:
That is in the line after the target string?
Would I do the same thing to get the second line of data?
When I try, it doesnt seem to...
Okay, so of course after that works I am told that the data contains doubles and hex numbers so I should just store the whole line as a string. From the code above, I am already at the right line in...
Okay I got this one working. I just replaced that if statement with one I already had [ if(strstr(line, term) != NULL)]
Thank you so much for your time and help!
Well, it looked good and I'm sure it's fine. I am just still having trouble getting to the next two lines after finding the target string. Some debugging I did said that when I used the sscanf(line,...
Thank you very much this is great!
And I'd like to assign each number to a variable.
ex. num1 = 34872
num2 =58908
num3 = 17830
num4 = 47674
Sorry about the delayed response. I don't have internet acces on my coding computer so it takes some running around to get here. This is what i use to find the word:
File *file;
file =...
Thank you for the fast reply. I will give that a shot.
Hey guys, I am having some trouble reading a file for a specific string then getting the next two lines of numbers after it. The file would look something like this:
Bill
12345 67890
64528 09342...