파일 읽기 문제...도와주세요

kaneyja의 이미지

먼저 파일 내용은

     110       0       0       2       0                __.190         0D   1000
 
     110    1001       0       0   10000       0       0       000000001D   1001
 
     110       0       0       2       0                __.190         0D   1002
 
110,-581.6889389,-432.9301917,-49.9753695,-587.5697479,                1P      1
 
-419.9261968,-148.9516909,0,0;                                         1P      2
 
110,-581.6889389,-432.9301917,-49.9753695,-587.5697479,                1P      1
 
-419.9261968,-148.9516909,0,0;                                         1P      2
 
110,-574.4840324,-429.6785974,-49.99283728,-580.6719012,               3P      3
 
-416.9890446,-148.991249,0,0;                                          3P      4
 
110,-567.2386701,-426.5186831,-50.05565551,-573.6786302,               5P      5
 
-414.1780815,-149.0820988,0,0;                                         5P      6
 
110,-559.950437,-423.4600172,-50.15159944,-566.1719328,                7P      7
 
-411.5578529,-149.2456531,0,0;                                         7P      8
 
110,-552.6124401,-420.5217683,-50.16860552,-555.4980227,               9P      9
 
-409.4287531,-149.5095257,0,0;                                         9P     10
.
.
.

위와 같이 되어 있습니다. 이 파일을 불러와서

"110," 를 찾아서 콤마(,)로 구분된 값들을 변수에 저장 하고 싶습니다.

예를 들어
110,-552.6124401,-420.5217683,-50.16860552,-555.4980227, 9P 9

-409.4287531,-149.5095257,0,0;

이 값은 "110," 뒤에 -552.6124401 값과, -420.5217683 값, -50.16860552 값
-555.4980227 , -409.4287531, -149.5095257 값 이렇게 6개 값만 저장하고 싶네요
좋은 아이디어가 없을까요?

kaneyja의 이미지

110,1.128812467,336.1946806,40.3832329,61.05838059,240.2594145,        1P      1
 
-17.08603096,0,0;                                                      1P      2

위와 같은 데이터는 67, 336.1946806,40.3832329, ...이렇게 읽네요 ㅠㅠ
1.128812467 부터 읽어야 하는데 ....
67 부터 읽습니다 ㅠㅠ
qiiiiiiiip의 이미지

문제를 재현하는 최소한의 코드를
컴파일 및 실행 가능한 형태로 (main 포함) 올려주세요.

저걸 눈으로 쓱 봐서 어디가 문제인지 알아내는 능력자도 물론 있겠지만,
올려주신 코드를 카피 페이스트 해서 돌려보고 문제점을 찾을 수 있다면,
훨씬 더 많은 분들이 시도해볼 겁니다..

또 본인 생각에 문제와 상관없는 부분을 제거하다보면,
어디가 문제인지 스스로도 직접 알아낼 수 있고요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.